Merge ~racb/git-ubuntu:style-on-imports into git-ubuntu:master

Proposed by Robie Basak
Status: Merged
Merged at revision: 0693d94738465199de341a3eb71922ba61cd167d
Proposed branch: ~racb/git-ubuntu:style-on-imports
Merge into: git-ubuntu:master
Diff against target: 22 lines (+14/-0)
1 file modified
doc/STYLE.md (+14/-0)
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+376449@code.launchpad.net

Commit message

Make Jenkins happy

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:0693d94738465199de341a3eb71922ba61cd167d
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/426/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/426//rebuild

review: Approve (continuous-integration)
Revision history for this message
Bryce Harrington (bryce) wrote :

Totally agreed, IIRC this is the style Launchpad uses in its codebase, and it's what I do in my own projects.

I tend not to care how each section is sorted, but doing so alphabetically works fine for me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/doc/STYLE.md b/doc/STYLE.md
2index 497edf0..d7ee95b 100644
3--- a/doc/STYLE.md
4+++ b/doc/STYLE.md
5@@ -30,3 +30,17 @@
6
7 * In snapcraft.yaml, cache external dependencies on our infrastructure
8 wherever possible.
9+
10+ * Divide imports into three sections separated by a blank line:
11+
12+ 1) Standard library imports (eg. collections, time, unittest.mock).
13+ 2) Third party library imports (eg. pytest).
14+ 3) Project-specific imports (eg. `import gitubuntu.git_repository as
15+ git_repository`).
16+
17+ This avoids hiding a small number of project-specific or third party
18+ library imports into a wall of standard library imports, giving the
19+ reader an immediately clearer view of the less usual entries being
20+ brought into the namespace.
21+
22+ * Keep imports sorted. This keeps diffs cleaner.

Subscribers

People subscribed via source and target branches