Page MenuHomeSoftware Heritage

refactor non-cli code out of cli in swh-scanner
ClosedPublic

Authored by tenma on Sep 11 2020, 5:33 PM.

Details

Summary

moved non-cli code including imports out of cli module to scanner module

Depends on D3900

Diff Detail

Repository
rDTSCN Code scanner
Branch
scanner-config
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15081
Build 23249: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 23248: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D3931 (id=13857)

Could not rebase; Attempt merge onto f838fed672...

Updating f838fed..8ab1bc9
Fast-forward
 swh/scanner/cli.py                | 106 ++++++++++++++++++--------------------
 swh/scanner/scanner.py            |  91 ++++++++++++++++++++++++++++----
 swh/scanner/tests/test_cli.py     |  16 ------
 swh/scanner/tests/test_scanner.py |  23 +++++++--
 4 files changed, 147 insertions(+), 89 deletions(-)
 delete mode 100644 swh/scanner/tests/test_cli.py
Changes applied before test
commit 8ab1bc99c170b423774fa885552a9777f62898bb
Author: tenma <tenma+swh@mailbox.org>
Date:   Fri Sep 11 17:24:47 2020 +0200

    refactor non-cli code out of cli in swh-scanner
    
    moved non-cli code including imports out of cli module to scanner module

commit 95e0af65495bb3b1af3d6d6f31015ffef11bd4af
Author: tenma <tenma+swh@mailbox.org>
Date:   Fri Sep 11 16:54:38 2020 +0200

    Add standard config support and auth token for swh-scanner
    
    - impl a full SWH config scheme, which loads config like the following
    (descending priority):
        - CLI switch for config path
        - CLI envvar for component config path (click auto_envvar feature)
        - CLI envvar for global config path
        - default global config path under ~/.config/swh/global.yml
        - merge loaded config with default specific config mapping
    - for now the default config path is hardcoded but will move to swh.core.config later
    - url and token config is namespaced with web-api to start having a
    consistent hierarchical config model accross components
    - added simple HTTP auth token support for requests to the SWH API,
    without adding yet another dependency for a small middleware
    
    Close T2572

See https://jenkins.softwareheritage.org/job/DTSCN/job/tests-on-diff/48/ for more details.

This revision is now accepted and ready to land.Sep 11 2020, 5:54 PM
douardda added a subscriber: douardda.

Just as small thing: please use imperative mood in the commit message. The subject is ok, but the "moved [...]" is not.
Also it would make more sense to explicitly refers to cli.py instead of just cli in the subject, i.e.:

refactor non-cli code out of cli.py in swh-scanner

This revision now requires changes to proceed.Sep 14 2020, 12:32 PM

A message body is descriptive, the intent is different from the subject line, so it does not require imperative mood, as far as I know.
Commit bodies don't particularly use the imperative mood in the repo.
I mentioned the CLI functionality rather than the file, which I could also reformulate as "swh-scanner's CLI", but as your prefer I will use cli.py to be explicit about the location of the code.

This revision was not accepted when it landed; it landed in state Needs Revision.Sep 14 2020, 2:10 PM
This revision was automatically updated to reflect the committed changes.