Skip to content

Commit bda5fc7

Browse files
OshriAsulinBaruch Odembaruchiro
authored
fix: ignore pip install .whl file (#142)
Continue of #140 Close #119 I added a change for ignore commands that end with `.whl`, and I also added an example to real-examples.yaml --------- Co-authored-by: Baruch Odem <baruch.odem@checkmarx.com> Co-authored-by: Baruch Odem (Rothkoff) <baruchiro@gmail.com>
1 parent dcdf44f commit bda5fc7

File tree

4 files changed

+110
-17
lines changed

4 files changed

+110
-17
lines changed

src/content/registry/python.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ const handleArgument = (argument, restCommandWords) => {
9090

9191
const baseCommandMatch = (line) => line.match(/pip3? +install/);
9292
const packageWordParse = (word) => {
93+
if (word.endsWith('.whl')) {
94+
console.debug('Ignoring package with ".whl":', word);
95+
return null;
96+
}
97+
9398
const match = word.match(packageArea);
9499
if (!match) return null;
95100

src/content/registry/python.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe(parseCommand.name, () => {
1717
'install numpy‑1.9.2+mkl‑cp34‑none‑win_amd64.whl',
1818
'install MySQL_python==', // Although this is a valid package name, it's not a valid command
1919
'install -r requirements.txt',
20+
'install scipy-0.16.1-cp27-none-win_amd64.whl',
2021
];
2122
const createCommand = (packageManager) => commands.map((command) => `${packageManager} ${command}`);
2223

tests/real-examples/real-examples-results.yaml

Lines changed: 100 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/real-examples/real-examples.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ links:
9797
comment: pip3 install command
9898
post: answer
9999
registry: pypi
100+
https://stackoverflow.com/a/33984261:
101+
comment: should Ignore this .whl as a package
102+
post: answer
103+
registry: pypi
100104

101105
https://stackoverflow.com/a/27709931:
102106
comment: go get standard library

0 commit comments

Comments
 (0)