summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-06-14 14:28:42 +0200
committerGeremia Taglialatela <[email protected]>2023-06-14 14:28:42 +0200
commitd5c945a9f81e92b68e10c3680882648ee42df00d (patch)
treeb092ea046026e623ee7ead6233c6c97c908ffc39
parente74c75b95d39fb51512387031e79f50e52a5874a (diff)
downloadcaxlsx-d5c945a9f81e92b68e10c3680882648ee42df00d.tar.gz
caxlsx-d5c945a9f81e92b68e10c3680882648ee42df00d.zip
Enable Naming/PredicateName cop
Renaming the existing methods would break the public API, and it is not worth to alias and/or deprecate existing methods, so this commit enables Naming/PredicateName and allows the existing methods to preserve their name
-rw-r--r--.rubocop_todo.yml12
-rw-r--r--lib/axlsx/workbook/worksheet/cell.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet_comments.rb2
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet_drawing.rb2
4 files changed, 5 insertions, 17 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index a855f812..dff9aacc 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -103,18 +103,6 @@ Naming/MethodName:
Naming/MethodParameterName:
Enabled: false
-# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
-# NamePrefix: is_, has_, have_
-# ForbiddenPrefixes: is_, has_, have_
-# AllowedMethods: is_a?
-# MethodDefinitionMacros: define_method, define_singleton_method
-Naming/PredicateName:
- Exclude:
- - 'spec/**/*'
- - 'lib/axlsx/workbook/worksheet/cell.rb'
- - 'lib/axlsx/workbook/worksheet/worksheet_comments.rb'
- - 'lib/axlsx/workbook/worksheet/worksheet_drawing.rb'
-
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, camelCase
Naming/VariableName:
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb
index 67f84fbc..7f24c9b7 100644
--- a/lib/axlsx/workbook/worksheet/cell.rb
+++ b/lib/axlsx/workbook/worksheet/cell.rb
@@ -167,7 +167,7 @@ module Axlsx
# Indicates that the cell has one or more of the custom cell styles applied.
# @return [Boolean]
- def is_text_run?
+ def is_text_run? # rubocop:disable Naming/PredicateName
defined?(@is_text_run) && @is_text_run && !contains_rich_text?
end
@@ -391,13 +391,13 @@ module Axlsx
CellSerializer.to_xml_string r_index, c_index, self, str
end
- def is_formula?
+ def is_formula? # rubocop:disable Naming/PredicateName
return false if escape_formulas
type == :string && @value.to_s.start_with?(FORMULA_PREFIX)
end
- def is_array_formula?
+ def is_array_formula? # rubocop:disable Naming/PredicateName
return false if escape_formulas
type == :string &&
diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb
index c5f5ad13..3ebaedee 100644
--- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb
@@ -37,7 +37,7 @@ module Axlsx
# Helper method to tell us if there are comments in the comments collection
# @return [Boolean]
- def has_comments?
+ def has_comments? # rubocop:disable Naming/PredicateName
!comments.empty?
end
diff --git a/lib/axlsx/workbook/worksheet/worksheet_drawing.rb b/lib/axlsx/workbook/worksheet/worksheet_drawing.rb
index 18c7189a..c66fe0ec 100644
--- a/lib/axlsx/workbook/worksheet/worksheet_drawing.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet_drawing.rb
@@ -38,7 +38,7 @@ module Axlsx
# helper method to tell us if the drawing has something in it or not
# @return [Boolean]
- def has_drawing?
+ def has_drawing? # rubocop:disable Naming/PredicateName
@drawing.is_a? Drawing
end