Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gsoc: package.json info extraction #118

Merged
merged 4 commits into from
Jun 26, 2017
Merged

gsoc: package.json info extraction #118

merged 4 commits into from
Jun 26, 2017

Conversation

satwikkansal
Copy link
Member

No description provided.

@satwikkansal satwikkansal changed the title Pakcage json info extraction gsoc:Pakcage json info extraction Jun 17, 2017
@satwikkansal
Copy link
Member Author

satwikkansal commented Jun 17, 2017

Note: The first 6 commits of this PR are based on #102

@meetmangukiya
Copy link
Member

Note: The first 6 commits of this PR are based on #102

Are you duplicating this 6 commits in all the PRs? That is bad, we request change in one PR and you'll have to rebase all the PRs, why not get the base merged first? 😕

@satwikkansal
Copy link
Member Author

I know it's bad, but keeping in mind the deadlines both have to be worked upon simultaneously

@satwikkansal satwikkansal changed the title gsoc:Pakcage json info extraction gsoc: package.json info extraction Jun 22, 2017
Copy link
Member

@adtac adtac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks alright except for a few comments here and there



class VersionInfo(Info):
description = "Version range information."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version range? Like pip>=0.7.3? or an actual list of versions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be really neat to have an example value as a docstring for each type of Info



class ManPathsInfo(Info):
description = "Related to man-pages"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean actual man-page archive file paths or just the term?



class PackageJSONInfoExtractor(InfoExtractor):
supported_file_globs = ("package.json",)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick question: the . in the glob isn't "match any character", right? Do we need to escape it? I don't quite remember how our globbing works :D

The simplest way to test would be to create a file called "packagexjson" and see if it's picked up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. matches only ., just verified :)
packagexjson fails for glob "package.json"
and package.json falis for escaped glob "package/.json"

VersionInfo)


class PackageJSONInfoExtractor(InfoExtractor):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you include a link to something like a RFC/spec defining what goes into a package.json file? Same thing for all other files too. It'd be neat to have a reference link right in the code.

ManPathsInfo)

def parse_file(self, fanme, file_content):
return json.loads(file_content)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can possibly throw exceptions if the input is malformed; can we wrap it around a try-except and return {} if there's some error?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and add a test that verifies this scenario

@@ -27,9 +27,11 @@ def find_information(self, fname, parsed_file):
class InfoA(Info):
description = 'Information A'
value_type = (str, int)
example_values = ['coala', 420]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe

@adtac
Copy link
Member

adtac commented Jun 25, 2017

ack 546df54 db143e6 0210fd4 1475727

@satwikkansal
Copy link
Member Author

reack 580eec8 49d844b

@adtac
Copy link
Member

adtac commented Jun 26, 2017

@rultor merge

@rultor
Copy link

rultor commented Jun 26, 2017

@rultor merge

@adtac OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link

rultor commented Jun 26, 2017

@rultor merge

@adtac @satwikkansal Oops, I failed. You can see the full log here (spent 2min)

+ cd ..
+ cat
+ '[' false = true ']'
+ cat
+ chmod a+x entry.sh
+ cat
+ echo 'export '\''[email protected]:satwikkansal/coala-quickstart.git'\''' ';' 'export '\''fork_branch=pakcage_json_info_extraction'\''' ';' 'export '\''[email protected]:coala/coala-quickstart.git'\''' ';' 'export '\''head_branch=master'\''' ';' 'export '\''pull_id=118'\''' ';' 'export '\''pull_title=gsoc: package.json info extraction'\''' ';' 'echo "Nothing to do."' ';'
+ rm -rf .gpg
+ cd repo
+ git remote add fork [email protected]:satwikkansal/coala-quickstart.git
+ git remote update
Fetching origin
Fetching fork
From github.com:satwikkansal/coala-quickstart
 * [new branch]      42         -> fork/42
 * [new branch]      79         -> fork/79
 * [new branch]      a          -> fork/a
 * [new branch]      appveyor   -> fork/appveyor
 * [new branch]      clean_tests -> fork/clean_tests
 * [new branch]      editorconfig_info_extraction -> fork/editorconfig_info_extraction
 * [new branch]      gemfile_info_extraction -> fork/gemfile_info_extraction
 * [new branch]      gruntfile_info_extractor -> fork/gruntfile_info_extractor
 * [new branch]      info_extraction -> fork/info_extraction
 * [new branch]      master     -> fork/master
 * [new branch]      package_json -> fork/package_json
 * [new branch]      package_json_info_extractor -> fork/package_json_info_extractor
 * [new branch]      pakcage_json_info_extraction -> fork/pakcage_json_info_extraction
 * [new branch]      remove_pyenv -> fork/remove_pyenv
 * [new branch]      sils/asd   -> fork/sils/asd
 * [new branch]      sils/content -> fork/sils/content
 * [new branch]      sils/imp   -> fork/sils/imp
 * [new branch]      sils/perfection -> fork/sils/perfection
 * [new branch]      sils/st    -> fork/sils/st
 * [new branch]      t          -> fork/t
 * [new branch]      test_ci    -> fork/test_ci
 * [new branch]      travis     -> fork/travis
 * [new branch]      travis_temp -> fork/travis_temp
+ args=
+ '[' only == default ']'
+ '[' only == no ']'
+ '[' only == only ']'
+ args=' --ff-only'
+ export BRANCH=__rultor
+ BRANCH=__rultor
++ git show-branch __rultor
++ wc -l
+ '[' 0 -gt 0 ']'
+ git checkout -B __rultor fork/pakcage_json_info_extraction
Switched to a new branch '__rultor'
Branch __rultor set up to track remote branch pakcage_json_info_extraction from fork.
+ git checkout -B master origin/master
Switched to and reset branch 'master'
Branch master set up to track remote branch master from origin.
Your branch is up-to-date with 'origin/master'.
+ '[' false == true ']'
+ '[' false == true ']'
+ git merge --ff-only __rultor
fatal: Not possible to fast-forward, aborting.
'cid' file is absent, container wasn't started correctly

Adds a class attribute named spec_references which
contains links to the issues/documentations for
relevant specs of supported files.

Related to #126
Adds a class attribute named example_values illustrating
sample information values that are allowed to be stored
inside the Info class.

Closes #125
Adds Info classes relevant to extractors
of package.json and other meta-files.

Related to #100
Adds ``PackageJSONInfoExtractor`` class to extract relevant
information from package.json file.

Closes #100
@adtac
Copy link
Member

adtac commented Jun 26, 2017

ack 5ffd9b8 299c5e2 1d16901 a348113

@adtac
Copy link
Member

adtac commented Jun 26, 2017

@rultor merge

@rultor
Copy link

rultor commented Jun 26, 2017

@rultor merge

@adtac OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 299c5e2 into coala:master Jun 26, 2017
@rultor
Copy link

rultor commented Jun 26, 2017

@rultor merge

@adtac Done! FYI, the full log is here (took me 2min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants