Skip to content

Commit

Permalink
Rubocop: Avoid adding exec file permissions
Browse files Browse the repository at this point in the history
- Disable autocorrection for the Lint/ScriptPermission cop
  or disable it completely
- Related to bsc#1209094
- 4.6.1
  • Loading branch information
lslezak committed Mar 13, 2023
1 parent bc21d65 commit 0e1b0f1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
8 changes: 8 additions & 0 deletions package/yast2-devtools.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Mar 10 17:23:47 UTC 2023 - Ladislav Slezák <lslezak@suse.com>

- Rubocop configuration update: Disable autocorrection for the
Lint/ScriptPermission cop or disable it completely.
(related to bsc#1209094)
- 4.6.1

-------------------------------------------------------------------
Fri Mar 03 14:44:07 UTC 2023 - Ladislav Slezák <lslezak@suse.cz>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-devtools.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-devtools
Version: 4.6.0
Version: 4.6.1
Release: 0
Summary: YaST2 - Development Tools
License: GPL-2.0-or-later
Expand Down
13 changes: 13 additions & 0 deletions ytools/y2tool/rubocop-0.71.0_yast_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,16 @@ Style/TernaryParentheses:
# And template version is needed if there are more params and it needs some formatting.
Style/FormatStringToken:
Enabled: false

# Disable autocorrection for the Lint/ScriptPermission check.
#
# When Rubocop finds a shebang ("#!/usr/bin/env ruby") at the beginning of
# a file it checks for the executable file flag. That makes sense.
# However, the autocorrection action is to always add the exec flag to the file,
# but in some situations the correct fix is to actually remove the shebang as it
# does not make sense. For example the file just defines a class and there is
# nothing to execute).
#
# So require the developer to decide what is the correct fix.
Lint/ScriptPermission:
AutoCorrect: false
19 changes: 19 additions & 0 deletions ytools/y2tool/rubocop-1.24.1_yast_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,22 @@ Metrics/BlockLength:
# rspec is known as DSL with big blocks
Exclude:
- "**/test/**/*"

# Disable the Lint/ScriptPermission check.
#
# When Rubocop finds a shebang ("#!/usr/bin/env ruby") at the beginning of
# a file it checks for the executable file flag. That makes sense.
# However, the autocorrection action is to always add the exec flag to the file,
# but in some situations the correct fix is to actually remove the shebang as it
# does not make sense (e.g. the file just defines a class and there is nothing
# to execute).
#
# NOTE: Ideally the check should be enabled with autocorrection disabled. But
# there is a bug in Rubocop 1.24.1 and disabled autocorrection is ignored,
# it always adds the exec flag. :-(
#
# So disable the cop completely and check how it behaves in the future Rubocop
# versions.
#
Lint/ScriptPermission:
Enabled: false

0 comments on commit 0e1b0f1

Please sign in to comment.