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

extend linter API to allow overriding the max line length #51

Merged
merged 3 commits into from
May 10, 2016

Conversation

dirk-thomas
Copy link
Contributor

Code generators can't always ensure that the generated code stays within a specific maximum line length. So using this that setting can be overridden.

@dirk-thomas dirk-thomas self-assigned this May 7, 2016
@dirk-thomas dirk-thomas added the in review Waiting for review (Kanban column) label May 7, 2016
if args.linelength != code_width:
# generate temporary config file with custom line length
temp_config = tempfile.NamedTemporaryFile('w')
temp_config.write(config_str + '\ncode_width=%d' % args.linelength)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appends the config parameter, but does not remove the original if it's already set. Will that work correctly in that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in an ini-like file the last value is the one being used.

@tfoote
Copy link
Member

tfoote commented May 10, 2016

+1

@dirk-thomas dirk-thomas merged commit 7e386ac into master May 10, 2016
@dirk-thomas dirk-thomas deleted the lint_generated_code branch May 10, 2016 21:39
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label May 10, 2016
code_width = int(re.split('[ \t#]', code_width, maxsplit=1)[0])
if args.linelength != code_width:
# generate temporary config file with custom line length
temp_config = tempfile.NamedTemporaryFile('w')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile

Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).

Fixed in #52.

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

Successfully merging this pull request may close these issues.

None yet

2 participants