bumpversion icon indicating copy to clipboard operation
bumpversion copied to clipboard

.bumpversion.cfg:7: new blank line at EOF.

Open imZack opened this issue 9 years ago • 12 comments

I am using latest version of bumpversion. When I command bumpversion patch with a pre-defined .bumpversion.cfg it always shows me the error message below:

.bumpversion.cfg:7: new blank line at EOF.

I had strip the new blank line but bumpversion seems like adding another newline for me automatically. Any thoughts?

imZack avatar Jan 05 '15 09:01 imZack

Seems like a warning originating from git / your specific git config. Can you post your git config --list output (please remember strip auth tokens etc. (!)) ?

peritus avatar Jan 05 '15 09:01 peritus

Cool, thanks for your response. This is my git config --list result, I can't find any related config inside.

[email protected]
user.name=YuLun Shih
core.editor=vim
url.https://.insteadof=git://
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true

imZack avatar Jan 05 '15 09:01 imZack

I might have fixed this as part of making the tests run on windows (are you running windows btw?) here: https://github.com/peritus/bumpversion/pull/64#issuecomment-70079805

Can you install the current version by executing

pip install https://github.com/peritus/bumpversion/archive/master.zip#egg=bumpversion-dev

and let me know if the problem still persists ?

peritus avatar Jan 15 '15 12:01 peritus

It works like a charm :bowtie: TY!

imZack avatar Jan 15 '15 13:01 imZack

Just curious, are you using windows ?

peritus avatar Jan 15 '15 13:01 peritus

@peritus Oop! I just found out If I use nano editor it works! It only happens when I use sublime text with editorconfig plugin. Btw, I am using Debian.

This is my .editorconfig file

# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

# We recommend you to keep these unchanged
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
# Change these settings to your own preference
indent_style = space
indent_size = 2

[*.py]
# Change these settings to your own preference
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false

imZack avatar Jan 15 '15 13:01 imZack

http://stackoverflow.com/questions/27059239/git-new-blank-line-at-eof seems to be a valuable resource here.

peritus avatar Jan 15 '15 13:01 peritus

This could be the culprit:

insert_final_newline = true

As far as I understand it's recommended to have a newline character (also known as \n) at the end of a file, but not a 'blank line' (that's what git is complaining about here).

peritus avatar Jan 15 '15 13:01 peritus

Yes, I have read this article before, but what I am noticed is after executing bumpversion patch the .bumpversion.cfg is added "another blank line" for me. That cause the problem.

imZack avatar Jan 15 '15 13:01 imZack

You're right. bumpversion indeed adds a blank line to the config file after writing. The question is: Should it ?

peritus avatar Jan 15 '15 13:01 peritus

Yep, I think it shouldn't append another additional blank line.

imZack avatar Jan 15 '15 14:01 imZack

adding another blank line fails precommit scripts too https://github.com/pre-commit/pre-commit-hooks/blob/master/pre_commit_hooks/end_of_file_fixer.py

in my case version bump is part of ci process which results in precommit failures like:

hookid: end-of-file-fixer

Files were modified by this hook. Additional output:

Fixing .bumpversion.cfg

would be nice to make this configurable. meanwhile have to skip precommit on bump file itself

miki725 avatar Jun 08 '18 16:06 miki725