Skip to content

Provide a command to check validity of ABOUT files #281

Closed

Description

@tdruez

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.

Activity

  1. tina1998612 commented on Apr 5, 2017

    @tina1998612

    Is this like checking the version and the validity of the urls in the ABOUT file?

  2. pombredanne commented on Apr 5, 2017

    @pombredanne
    Member

    @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

  3. tina1998612 commented on Apr 5, 2017

    @tina1998612

    @pombredanne can I take a look at the CSV output generated?

  4. pombredanne commented on Apr 5, 2017

    @pombredanne
    Member

    @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.

  5. tina1998612 commented on Apr 6, 2017

    @tina1998612

    @pombredanne so I may take reference at the data here for testing?

  6. chinyeungli commented on Apr 6, 2017

    @chinyeungli
    Contributor
  7. pombredanne commented on Apr 21, 2017

    @pombredanne
    Member

    @tina1998612 Any update on your side?

  8. added a commit that references this issue on Aug 9, 2017
  9. chinyeungli commented on Aug 9, 2017

    @chinyeungli
    Contributor

    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

  10. tdruez commented on Aug 9, 2017

    @tdruez
    ContributorAuthor

    @chinyeungli Great start! Easy to use:

    ./about check thirdparty/
    Running attributecode version 3.0.0.dev4
    Checking ABOUT files...
    CRITICAL: Cannot load invalid ABOUT file: '/Volumes/nexB/dejacode/thirdparty/FixedHeader.ABOUT': ParserError()
    CRITICAL: Cannot load invalid ABOUT file: '/Volumes/nexB/dejacode/thirdparty/Font-Awesome.ABOUT': ScannerError()
    

    Now, ParserError() and ScannerError() 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

  11. tdruez commented on Aug 9, 2017

    @tdruez
    ContributorAuthor

    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
    
  12. changed the title [-]Profide a command to check validity of ABOUT files[/-] [+]Provide a command to check validity of ABOUT files[/+] on Aug 9, 2017
  13. tdruez commented on Aug 10, 2017

    @tdruez
    ContributorAuthor

    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.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions