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

File header update should actually update the existing header instead of simply adding one #790

Open
lflender opened this issue Mar 1, 2021 · 2 comments

Comments

@lflender
Copy link
Contributor

lflender commented Mar 1, 2021

Environment

  • Visual Studio 2019
  • CodeMaid version: 11.2
  • Code language: Any

Description

Currently, when a header is added in Cleaning/Update/File header, the provided sample is simply added to the file if the current header does not start with the sample. The current header should be entirely removed and replaced by the new one.

Steps to recreate

  1. Go to Cleaning/Update
  2. Provide a file header, e.g. // Copyright © 2021 by MyCompany Inc.
  3. Cleanup a file with an existing header, e.g. // Copyright © 2020 by MyCompany Inc.

Current behavior

The new header is added before the previous one

Expected behavior

The new header should replace the previous one

@codecadwallader
Copy link
Owner

Thanks for reporting the issue. Please take a look at #757 and see if that helps.

@lflender
Copy link
Contributor Author

lflender commented Mar 3, 2021

To me this is a different issue. I wish to replace old headers from files with a new one, and I cannot do that. New headers have a different structure from the old ones. CodeMaid currently does not manage the removal from any header and simply adds one.

codecadwallader pushed a commit that referenced this issue May 7, 2021
…sent (#797)

* File header update now replaces the file header if one is already present

Fixing issues #790 #757

* Adding option to choose between Insert or Replace file header

* Addressing PR comments

Co-authored-by: lflender <[email protected]>
codecadwallader pushed a commit that referenced this issue Jul 18, 2021
…815)

* File header update now replaces the file header if one is already present

Fixing issues #790 #757

* Adding option to choose between Insert or Replace file header

* Addressing PR comments

* Added an option to update file headers after using blocks for C#

* Fixed file header update crashing when replacing with a header not ending with newline

Co-authored-by: lflender <[email protected]>
codecadwallader pushed a commit that referenced this issue Aug 22, 2021
…828)

* File header update now replaces the file header if one is already present

Fixing issues #790 #757

* Adding option to choose between Insert or Replace file header

* Addressing PR comments

* Added an option to update file headers after using blocks for C#

* Fixed file header update crashing when replacing with a header not ending with newline

* Added an option to include access level in regions only for methods

Co-authored-by: lflender <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants