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

CopyrightBear / LicenseCheckBear #823

Open
jayvdb opened this issue Sep 14, 2016 · 27 comments · Fixed by #1442
Open

CopyrightBear / LicenseCheckBear #823

jayvdb opened this issue Sep 14, 2016 · 27 comments · Fixed by #1442

Comments

@jayvdb
Copy link
Member

jayvdb commented Sep 14, 2016

A lint that is often missed is including copyright headers, and updating copyright years.

https://pypi.python.org/pypi/flake8-copyright

However some languages there are empty files, like python package __init__.py files, and no copyright header is needed.

savoirfairelinux/flake8-copyright#1 (comment)

@gitmate-bot
Copy link
Collaborator

Thanks for reporting this issue! A coalaian will look at it soon.

@sils
Copy link
Member

sils commented Sep 14, 2016

This could be quite simple in a language independent manner without even caring if it's a comment or not as it should be quite impossible to write code that looks like a copyright header without knowing about it.

Neat idea!

@jayvdb
Copy link
Member Author

jayvdb commented Sep 14, 2016

The required header can be a literal multiline value that must appear.

Different languages have different sections in .coafile, so that variation is already catered for.

Typically the copyright header varies with different names per file. Worst case dedicated sections in the .coafile support this.

Allowing patterns and variables in the template would help.

@sils
Copy link
Member

sils commented Sep 14, 2016

@jayvdb would you be interested in doing this? I'll be available for help of course alongside http://coala.io/writingbears. Otherwise if it's a priority for you or someone else I'm sure we'll find someone who can look into it as it should be rather quick and rewarding.

@jayvdb
Copy link
Member Author

jayvdb commented Sep 14, 2016

Not a priority for me.

@jayvdb
Copy link
Member Author

jayvdb commented Sep 27, 2016

A script that is commonly used is licensecheck.pl from KDE, which made its way into Chromium, and I've noticed it just now appearing in html5lib/html5lib-python#303

@sils
Copy link
Member

sils commented Oct 8, 2016

@jayvdb do you think it makes sense to try to be better than licensecheck.pl or just wrap it? We could easily include it in the distribution I guess.

@jayvdb
Copy link
Member Author

jayvdb commented Oct 9, 2016

@sils, looks like we can wrap https://packages.debian.org/sid/licensecheck . With Debian and Chromium using it, I think using the same maintained script is a good approach that helps packagers now.
If someone wants to rewrite it, or build a feature complete equivalent, yay.

@Adrianzatreanu
Copy link
Contributor

hey @divyam3897 still on this :D ?

@divyam3897
Copy link

@Adrianzatreanu yes, stuck on few things which I am unable to figure out :( . I should commit what I am trying ? Though I have been trying to understand the workflow of the bears by going throught the bears and docs. Sorry, its taking too long :(

@Makman2
Copy link
Member

Makman2 commented Oct 30, 2016

Just visit us on gitter, there we can help you :)

@yash-nisar
Copy link
Member

Still on it @divyam3897 ?

@divyam3897
Copy link

@yash-nisar didn't get the time to hack on it. Feel free to assign it to someone else to make it done faster. I can review the commits, progress and help with my so far progress :)

@yash-nisar
Copy link
Member

I would like to work on this @Makman2 @sils

@Makman2 Makman2 assigned yash-nisar and unassigned divyam3897 Jan 26, 2017
@yash-nisar
Copy link
Member

yash-nisar commented Jan 28, 2017

IIUC, the bear will check for copyright notices in all python files by running a simple regex search for strings like :
Copyright 2014 <author>
Copyright (C) 2014 <author>
as mentioned in https://github.com/savoirfairelinux/flake8-copyright
or should I wrap licensechecker too ?
CC @Makman2 @sils @jayvdb

@Makman2
Copy link
Member

Makman2 commented Jan 28, 2017

imo this is up to you ;)

yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Feb 18, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Feb 18, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Feb 18, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Feb 18, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 6, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 6, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 6, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 6, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 7, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 7, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 7, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 8, 2017
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 8, 2017
@yash-nisar
Copy link
Member

Can we rename is to LicenseCheckBear and create a new bear for checking Copyright ?

@Makman2
Copy link
Member

Makman2 commented Mar 9, 2017

If the issue is not completely solved, let's reopen it :)

@Makman2 Makman2 reopened this Mar 9, 2017
@yash-nisar
Copy link
Member

So the milestone now would be to add CopyrightBear ?

@jayvdb
Copy link
Member Author

jayvdb commented Mar 9, 2017

The existing external linter does both. The bear just needs improving.

@yash-nisar
Copy link
Member

We won't be able to create user defined regexes IIUC and will have to rely on the regex defined in the script. Is that okay ?

@jayvdb
Copy link
Member Author

jayvdb commented Mar 9, 2017

Many very important codebases use this external tool, so we need to expose its functionality via coala as sensibly as possible.

If someone wants a different regex, they can write a RegexBear, or their own copyright bear. ;)

Or they can enhance the external tool and then improve our bear.

@yash-nisar
Copy link
Member

yash-nisar commented Mar 9, 2017

So, we should match the regex *No copyright* and display the output message No copyright found or similar if the user sets this check_copyright option as True. Is that what you imply @jayvdb @Makman2 ?

@Makman2
Copy link
Member

Makman2 commented Mar 9, 2017

I don't imply anything, but sounds reasonable 👍 :)

@yash-nisar
Copy link
Member

Well, I will have to override process_output in this case too and match regexes for license as well as copyright notice. :)

gosom pushed a commit to gosom/coala-bears that referenced this issue Jul 15, 2017
@khanchi97
Copy link
Member

Hello @jayvdb I want to write this bear but I'm not confirmed which linter I have to wrap.The one that you gave https://pypi.python.org/pypi/flake8-copyright is only for python files but this bear would be a genericbear.So can you tell me which linter I have to use?

@jayvdb jayvdb changed the title CopyrightBear CopyrightBear / LicenseCheckBear Apr 16, 2018
@jayvdb
Copy link
Member Author

jayvdb commented Apr 16, 2018

This is about improving the LicenseCheckBear to be more usable.

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

Successfully merging a pull request may close this issue.

9 participants