Comments (9)
- putting quotes around the ignore path
yeah, this is one thing about ignore that I really don't love, but there's also little we can do about it. The difference between a quoted and unquoted ignore value have completely different meanings.... unquoted is interpreted by your shell, and quoted is passed to doublestar. I recall there being another issue where someone ran into this, bit I can't find it. I just noticed the readme file uses unquoted values in example and doesn't discuss this issue at all, which I'll work on fixing.
from addlicense.
Maybe a bug, not sure @braydonk, but at least I have a workaround that works.
In any case thanks for the help, @braydonk & @willnorris 😄
from addlicense.
I know this is an old issue, so chances are this is long solved. However in case anyone else happens to look at this issue for a solution:
Not exactly node_modules
, but when I want to ignore everything in my submodules
folder I use the pattern submodules/**/*
and that appears to do what you're describing.
I think doing **/node_modules/*
means "starting from any directory, in a folder called node_modules
, any file inside it", whereas what you want is **/node_modules/**
, which translates to "starting from any directory, in a folder called node_modules
, any directory inside it, any file inside any directory inside it".
from addlicense.
I will try this @braydonk , but as the team of doublestar mentioned they do not support negative
matching at the moment.
I think I tried **/node_modules/**
this pattern, but will give it a go soon again
from addlicense.
@braydonk I make the hypothesis that it does not based on the result after executing: addlicense -c "Neo4j Inc." -f license.txt -check ./**/*.{js,ts,css} -ignore **/node_modules/**
zsh: argument list too long: addlicense
from addlicense.
I made a quick test project that only installed express
and made a hello world index.js
.
I got the command to run with a couple changes:
braydonk@bk:~/Git/test-node$ addlicense -check -ignore "**/node_modules/**" -c "Neo4j Inc." -f license.txt -check ./**/*.{js,ts,css} .
2022/08/27 11:53:57 skipping: node_modules/ipaddr.js/LICENSE
2022/08/27 11:53:57 skipping: node_modules/ipaddr.js/README.md
2022/08/27 11:53:57 skipping: node_modules/ipaddr.js/ipaddr.min.js
2022/08/27 11:53:57 skipping: node_modules/ipaddr.js/lib/ipaddr.js
2022/08/27 11:53:57 skipping: node_modules/ipaddr.js/lib/ipaddr.js.d.ts
2022/08/27 11:53:57 skipping: node_modules/ipaddr.js/package.json
...
2 things I needed to fix:
- putting quotes around the ignore path
- Telling it which directory to use (see the
.
at the end)
The ignore path in quotes thing could use some documentation, and probably some usage examples.
from addlicense.
@braydonk did you include nested packages with node_modules
?
I execute the command you pasted: addlicense -check -ignore "**/node_modules/**" -c "Neo4j Inc." -f license.txt -check ./**/*.{js,ts,css,tsx} .
but still received zsh: argument list too long: addlicense
.
Tried to put the match pattern ./**/*.{js,ts,css,tsx}
in quotes but then yml
, sh
and other file types were matched.
Also tried matching with ls ./**/*.{js,ts,css,tsx}
and received a too long error.
To replicate also, a similar yarn workspace is here: https://github.com/konsalex/enterprise-design-system-course/tree/l6-3
Cloning and running yarn
will do the job to then test, in case you want to reproduce.
from addlicense.
The reason it matched everything is because you also had .
at the end of your command; that's the directory to search, and since the .yml
and .sh
paths aren't ignored it was found there. Probably buried in the output of the command was an error like this:
2022/08/29 11:33:39 ./**/*.{js,ts,css,tsx} error: lstat ./**/*.{js,ts,css,tsx}: no such file or directory
That's because the implementation uses filepath.Walk
when searching for files, and doublestar
globs for ignores. This means you can't call the command with only the extensions you want, but rather ignoring everything you don't want. You'll need to do something like this:
addlicense -check -ignore "**/node_modules/**" -ignore "**/*.{yml}" -c "Neo4j Inc." -f license.txt .
However it always matches the .yarnrc.yml
with everything I tried, so I'm not sure if that might be a bug or not.
from addlicense.
I believe there is a bug or discussion somewhere about using doublestar for searching as well. I can't remember what the blocker at the time was 😕
from addlicense.
Related Issues (20)
- use GoReleaser to build and push container images HOT 6
- use go-enry to identify generated, vendored and other types of code
- Support adding license header in .txt, .patch and .tmpl files HOT 5
- Ignore doesn't work without equals sign HOT 2
- Using `//` comments for C++ header files
- malformed module path "io/fs" HOT 2
- Intermittent failure
- Include basic example of running for the first time. HOT 1
- [Proposal] Usage as module instead of CLI HOT 3
- Can a new tag be added? HOT 1
- Introduce a flag to prefer `//` over `/*...*/` HOT 1
- Copyright line should append after the SPDX identifier HOT 3
- An extra whitespace indentation for the Apache License template
- Recursive check pattern HOT 1
- (Provide option to) ignore empty files
- Feature Request: Add a version subcommand HOT 1
- Bug: Files generated by stringer are skipped HOT 4
- How to install? `go get` is deprecated
- provide fail-on-diff flag to enable checking licence headers HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from addlicense.