florianschanda / miss_hit

MATLAB Independent, Small & Safe, High Integrity Tools - code formatter and more
GNU General Public License v3.0
160 stars 21 forks source link

`mh_copyright --add-notice` will include copyright in excluded directories #226

Closed Remi-Gau closed 3 years ago

Remi-Gau commented 3 years ago

I don't know whether this is the expected behavior but this could lead to copyright notices being added at the wrong places.

Your operating system and Python version Linux Python 3.8

miss_hit==0.9.25

miss_hit config

project_root

# style guide (https://florianschanda.github.io/miss_hit/style_checker.html)
tab_width: 2

line_length: 90

suppress_rule: "naming_functions"
suppress_rule: "naming_scripts"
suppress_rule: "naming_parameters"

copyright_entity: "Jim" 

exclude_dir: "lib"   <---- excluding code I did not write

Ran this:

mh_copyright --add-notice *

And then for example checking a file in the lib folder git diff lib/trk_plot.m

diff --git a/lib/trk_plot.m b/lib/trk_plot.m
index 926a14e..b7a0482 100644
--- a/lib/trk_plot.m
+++ b/lib/trk_plot.m
@@ -1,3 +1,5 @@
+% (c) Copyright 2021 Jim                                     <------------ oops?
+
 function trk_plot(header, tracks, volume, slices, plottype, scalar, debug)
     % TRK_PLOT - 3D plot of TrackVis .trk track group
florianschanda commented 3 years ago

I do note that you're kinda asking for it though, in that * will expand to include lib: the intended behaviour of exclude_dir is to not make it impossible to run miss_hit in that directory, just that the traversal will skip it, unless explicitly requested (which is what you're doing).

If you invoke mh_copyright without the *, or instead using . (which is the default anyway) then it works.

I think I will use this ticket to add more description to the semantics of exclude_dir

florianschanda commented 3 years ago

I've specifically added an example like this to the description of exclude_dir: https://florianschanda.github.io/miss_hit/configuration.html#exclude_dir

Remi-Gau commented 3 years ago

Ah yes! Now I get it!

Thanks for the clarification. :smile: