-
Notifications
You must be signed in to change notification settings - Fork 19
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
Linter for files in gitignore #41
Comments
My comment on this from #39
Yes, just like that!
Good point. However, as @jonfinerty pointed out offline:
So e.g., you have So to summarise, I think a global list of files to be expected in In the end, the role of the |
Here is a list of |
@M-Zuber Thanks! Quite a lot to get through! |
It can also serve as a checklist of sorts for languages to support 😉 |
Hahah, true yeah! |
I merged #51. Is that what we want and this is done, or do we want to upgrade it to download and parse the Thoughts on that:
|
Ooh. That would be good, but would it break the web interface? Argh. Hmm. The web interface is pretty cool, I love the fact that it works in the browser or on the command line. Does GitHub possibly give access to |
I'll look into the api, and test it out. Definitely agree that we can't break the web |
Cool! Let me know when you get to it, if I get some time sooner then I'll do it :) |
CORS resource sharing I am starting to think that it does not make sense. What I might do is try and create a tool that will
Or do it manually ;) |
I like the idea of using the GitHub API to get the gitignore templates because it helps us to suggest what people probably shouldn't have in the repo. But this may change quite a bit for every project, so it may not be such a popular idea. Worth a try, though, I think. We can always have a "don't use gitignore" flag. We'd have to use pretty much the exact same algorithm as git to make this work though, right? |
Your first point is something that I have been trying to come up with a good solution for. |
As far as the algorithm goes, I am not sure. |
A quick Google search doesn't bring anything up, but I don't think it'd be too hard to come up with a simple version. Most rules would be a matter of checking for existence using node's native filesystem stuff, and in some instances we'd wanna be recursive. As for making things optional, index.js already has some code in there for CLI stuff, so perhaps just adding a new flag for each linter would work, or a flag which accepts comma separated linter names. Then that gets passed through to the options of the main code called by both the web ui and CLI. |
I've been speaking to someone from github who works with the In the meantime, I think I want to start with taking the information from the defaults.
|
So I don't really know that part of the codebase to well yet. But it sounds like its easy enough to go either way, that we can leave this decision until everything else is implemented? |
Let's just stick with using name repos for now, don't want too much bureaucracy just yet.
Well presumably it'd have to be JS unless you wanna put some binaries of other things into the repo, right?
I figured that however the gitignore defaults thing works it'd be used as a module which simply retrieves gitignore defaults and then works in a similar way to the
Yeah, that's not a problem :) |
I actually was thinking of having a tool that is run every now and then, not in relation to forkability's actual code in order to do set up For example a c# .exe that can be set to run once a day/week that will update given files in the forkabilty repo. This way, during runtime no additional web calls have to be made
That is pretty much what happens now: for (var i = options.languages.length - 1; i >= 0; i--) {
if (languages[options.languages[i]]) {
lintOptions = merge(lintOptions, languages[options.languages[i]]);
} else {
console.warn('Sorry, Forkability doesn\'t support the language', options.languages[i] + '. If you\'re keen you can open a pull request at https://github.com/basicallydan/forkability/issues');
}
}
...
if(options.ignore || lintOptions.ignore) {
var ignoreOptions = merge(options.ignore, lintOptions.ignore);
report = lintIgnore(tree, ignoreOptions);
passes = passes.concat(report.passes);
failures = failures.concat(report.failures);
} and in a language file: module.exports = {
name: 'Node JS',
files: {
'package.json file':/^package\.json/i,
'No node_modules folder': {
path: /^node_modules/i,
shouldExist: false,
type:'tree'
}
},
ignore:{
'randomExtension': /^.+\.rnd/i
}
}; At the same time, the |
I have thought about this a bunch more and have come to the conclusion that Most of the rules are simple regex matching. The ones that are not are simple enough to define in the code. Am I making any sense? |
@M-Zuber Yes, you're making sense. However, I think using the file already in the repo will solve a different problem than the one being discussed previously in this thread. Let me refer to something I said earlier:
The Forkability could still help here by warning people that a file has been committed even though it's supposed to be excluded by the Am I making any sense? 😃 |
You do make sense(or more culturally accurate pence 😛 ), but Therefore I propose linting based off the actual |
This was first raised in #39
The idea is to add a
gitignore
field to the language object that will contain the files that are supposed to be not pushed to the repo due the fact that are in the.gitignore
fileThen there would be a separate linter to perform the checks
The text was updated successfully, but these errors were encountered: