fabric8-analytics / fabric8-analytics-lsp-server

Apache License 2.0
9 stars 33 forks source link

fix(pypi): Dependency count shown in stack analysis report is incorrect #103

Closed arajkumar closed 5 years ago

arajkumar commented 5 years ago

It fixes https://github.com/fabric8-analytics/fabric8-analytics-vscode-extension/issues/315.

Root cause:

Empty lines(with and without #) are also counted as dependencies.

Solution:

If parsed package name is empty, ignore it.

Cleanup:

I also did some refactoring to use JS map/reduce for a nice looking code :)

Testing:

Chai, mocha based unit tests has been added newly. Also added nyc based code coverage and modified code has been covered 100%.

Follow the below steps to test this change along with fabric8-analytics-vscode-extension,

git clone https://github.com/fabric8-analytics/fabric8-analytics-lsp-server.git
cd fabric8-analytics-lsp-server
git fetch https://github.com/arajkumar/fabric8-analytics-lsp-server.git fix-incorrect-dep-count-pypi
git checkout FETCH_HEAD
npm install && npm run build

git clone https://github.com/fabric8-analytics/fabric8-analytics-vscode-extension.git
cd fabric8-analytics-vscode-extension
git fetch https://github.com/invincibleJai/fabric8-analytics-vscode-extension fix-py-sup-ls
git checkout FETCH_HEAD
npm install /path/to/fabric8-analytics-lsp-server/output

# Then launch VS code & debug
Screen Shot 2019-07-30 at 4 24 56 PM
centos-ci commented 5 years ago

Can one of the admins verify this patch?

invincibleJai commented 5 years ago

@arajkumar can even enable the test to run in cico scripts and have one commit with semantic versioning.

arajkumar commented 5 years ago

@invincibleJai , Thanks for your review comments.

can even enable the test to run in cico scripts

Updated the cico script to run the unit test. How to verify this on CI?

and have one commit with semantic versioning

squashed the commit manually, but we can do that while we are merging this PR to master.

arajkumar commented 5 years ago

[test]

invincibleJai commented 5 years ago

[test]