You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a command to check validity of ABOUT files #281
Given a directory, I'd like to run a simple command to ensure the validity of all my ABOUT files.
Something like:
aboutcode check codebase/
This would return the list of errors and warnings along a proper exit code, or 0 if all ABOUT files are valid.
The purpose is to run that command before committing new libraries to a codebase and during the continuous integration, to prevent from pushing malformed ABOUT files and catch the potential issues upfront.
@tina1998612 this would more to actually load all ABOUT from a directory like this is done alright and then parse and report errors with a proper return code.
e.g. the validation would be done by lib alright.
What is done today is mostly it except the output is CSV. Here what @tdruez needs is not a CSV but a pass/fail command with proper error/warning details sent to stdout such that you can then integrate that as part of a test/CI run
@tina1998612 you could but that would likely be hackish. Instead you likely could do the exact same by iterating collected About objects, and gathering the errors and warning then print these to stderr if any and return a failure error code in that cli run.
Here's the content of the 2 files mentioned above:
FixedHeader.ABOUT
about_resource: FixedHeader-2.1.0-dev.zip
download_url: http://datatables.net/download/
version: 2.0.10-dev
name: DataTables FixedHeader
owner: Allan Jardine
home_url: http://datatables.net
description: "Fix" a header at the top of the table, so it scrolls with the table
contact: Allan Jardine http://www.sprymedia.co.uk/contact
dje_license: bsd-new
license_url: http://datatables.net/license_bsd
notice_file: FixedHeader.NOTICE
copyright: Copyright 2008-2012 Allan Jardine, all rights reserved.
notes: This source file is free software, under either the GPL v2 license or a
BSD style license, available at:
http://datatables.net/license_gpl2
http://datatables.net/license_bsd
Font-Awesome.ABOUT
about_resource: Font-Awesome-3.2.0.zip
version: 3.2.0
download_url: https://github.com/FortAwesome/Font-Awesome/archive/v3.2.0.zip
owner: FortAwesome
name: Font Awesome
home_url: http://fortawesome.github.com/Font-Awesome/
dje_license: ofl-1.1, mit, cc-by-3.0
notes: there are several licenses: SIL Open Font License, MIT License, CC BY 3.0 License, Attribution is no longer required in Font Awesome 3.0
notice_file: Font-Awesome.NOTICE
vcs_tool: git
vcs_repository: https://github.com/FortAwesome/Font-Awesome.git
Latest changes are great, much better output and proper exit code:
$ about-code check ./thirdparty/
Running attributecode version 3.0.0.dev4
Checking ABOUT files...
CRITICAL: Cannot load invalid ABOUT file: '/home/travis/build/nexB/dejacode/thirdparty/FixedHeader.ABOUT': ParserError()
while parsing a block mapping
in "<unicode string>", line 1, column 1
did not find expected key
in "<unicode string>", line 8, column 20
CRITICAL: Cannot load invalid ABOUT file: '/home/travis/build/nexB/dejacode/thirdparty/Font-Awesome.ABOUT': ScannerError()
mapping values are not allowed in this context
in "<unicode string>", line 10, column 34
Found 2 errors
The command "about-code check ./thirdparty/" failed and exited with 1 during .
Your build has been stopped.
Activity
tina1998612 commentedon Apr 5, 2017
Is this like checking the version and the validity of the urls in the ABOUT file?
pombredanne commentedon Apr 5, 2017
@tina1998612 this would more to actually load all ABOUT from a directory like this is done alright and then parse and report errors with a proper return code.
e.g. the validation would be done by lib alright.
What is done today is mostly it except the output is CSV. Here what @tdruez needs is not a CSV but a pass/fail command with proper error/warning details sent to stdout such that you can then integrate that as part of a test/CI run
tina1998612 commentedon Apr 5, 2017
@pombredanne can I take a look at the CSV output generated?
pombredanne commentedon Apr 5, 2017
@tina1998612 you could but that would likely be hackish. Instead you likely could do the exact same by iterating collected About objects, and gathering the errors and warning then print these to stderr if any and return a failure error code in that cli run.
tina1998612 commentedon Apr 6, 2017
@pombredanne so I may take reference at the data here for testing?
chinyeungli commentedon Apr 6, 2017
@tina1998612 Yes.
pombredanne commentedon Apr 21, 2017
@tina1998612 Any update on your side?
Create a 'check' command #281
chinyeungli commentedon Aug 9, 2017
The basic feature is there, but maybe hard to read since there is no reference about which errors reference to which about files. See #284
tdruez commentedon Aug 9, 2017
@chinyeungli Great start! Easy to use:
Now,
ParserError()andScannerError()does not help a lot to figure out the issue. Could you provide the line number?Also, could you return the exit code 1 in case of errors? This will allow to make the continuous integration fail using this value for example.
See https://github.com/PyCQA/pycodestyle/blob/master/pycodestyle.py#L2353 for example.
You can refer to https://github.com/PyCQA/pycodestyle for a good example of a tool that's easy to integrate to a continuous integration and returns nice errors output: https://github.com/PyCQA/pycodestyle#example-usage-and-output
tdruez commentedon Aug 9, 2017
Here's the content of the 2 files mentioned above:
FixedHeader.ABOUT
Font-Awesome.ABOUT
[-]Profide a command to check validity of ABOUT files[/-][+]Provide a command to check validity of ABOUT files[/+]tdruez commentedon Aug 10, 2017
Latest changes are great, much better output and proper exit code: