Skip to content

Commit

Permalink
Merge pull request caxlsx#321 from tagliala/chore/no-semicolon
Browse files Browse the repository at this point in the history
Fix Style/Semicolon offenses
  • Loading branch information
kiskoza authored Nov 28, 2023
2 parents cf06452 + fe1eb68 commit f593132
Show file tree
Hide file tree
Showing 58 changed files with 1,035 additions and 256 deletions.
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ Security:
Style:
Enabled: true

Style/Semicolon:
AllowAsExpressionSeparator: true

Style/NumericLiterals:
Exclude:
- 'lib/**/*'
5 changes: 0 additions & 5 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion lib/axlsx/content_type/abstract_content_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def initialize(options = {})

# The content type.
# @see Axlsx#validate_content_type
def content_type=(v) Axlsx.validate_content_type v; @content_type = v end
def content_type=(v)
Axlsx.validate_content_type v
@content_type = v
end
alias :ContentType= :content_type=

# Serialize the contenty type to xml
Expand Down
5 changes: 4 additions & 1 deletion lib/axlsx/content_type/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class Default < AbstractContentType
alias :Extension :extension

# Sets the file extension for this content type.
def extension=(v) Axlsx.validate_string v; @extension = v end
def extension=(v)
Axlsx.validate_string v
@extension = v
end
alias :Extension= :extension=

# Serializes this object to xml
Expand Down
5 changes: 4 additions & 1 deletion lib/axlsx/content_type/override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class Override < AbstractContentType
alias :PartName :part_name

# The name and location of the part.
def part_name=(v) Axlsx.validate_string v; @part_name = v end
def part_name=(v)
Axlsx.validate_string v
@part_name = v
end
alias :PartName= :part_name=

# Serializes this object to xml
Expand Down
111 changes: 89 additions & 22 deletions lib/axlsx/doc_props/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,89 +132,156 @@ def initialize(options = {})
alias :DocSecurity :doc_security

# Sets the template property of your app.xml file
def template=(v) Axlsx.validate_string v; @template = v; end
def template=(v)
Axlsx.validate_string v
@template = v
end
alias :Template= :template=

# Sets the manager property of your app.xml file
def manager=(v) Axlsx.validate_string v; @manager = v; end
def manager=(v)
Axlsx.validate_string v
@manager = v
end
alias :Manager= :manager=

# Sets the company property of your app.xml file
def company=(v) Axlsx.validate_string v; @company = v; end
def company=(v)
Axlsx.validate_string v
@company = v
end
alias :Company= :company=

# Sets the pages property of your app.xml file
def pages=(v) Axlsx.validate_int v; @pages = v; end
def pages=(v)
Axlsx.validate_int v
@pages = v
end

# Sets the words property of your app.xml file
def words=(v) Axlsx.validate_int v; @words = v; end
def words=(v)
Axlsx.validate_int v
@words = v
end
alias :Words= :words=

# Sets the characters property of your app.xml file
def characters=(v) Axlsx.validate_int v; @characters = v; end
def characters=(v)
Axlsx.validate_int v
@characters = v
end
alias :Characters= :characters=

# Sets the presentation_format property of your app.xml file
def presentation_format=(v) Axlsx.validate_string v; @presentation_format = v; end
def presentation_format=(v)
Axlsx.validate_string v
@presentation_format = v
end
alias :PresentationFormat= :presentation_format=

# Sets the lines property of your app.xml file
def lines=(v) Axlsx.validate_int v; @lines = v; end
def lines=(v)
Axlsx.validate_int v
@lines = v
end
alias :Lines= :lines=

# Sets the paragraphs property of your app.xml file
def paragraphs=(v) Axlsx.validate_int v; @paragraphs = v; end
def paragraphs=(v)
Axlsx.validate_int v
@paragraphs = v
end
alias :Paragraphs= :paragraphs=

# sets the slides property of your app.xml file
def slides=(v) Axlsx.validate_int v; @slides = v; end
def slides=(v)
Axlsx.validate_int v
@slides = v
end
alias :Slides= :slides=

# sets the notes property of your app.xml file
def notes=(v) Axlsx.validate_int v; @notes = v; end
def notes=(v)
Axlsx.validate_int v
@notes = v
end
alias :Notes= :notes=

# Sets the total_time property of your app.xml file
def total_time=(v) Axlsx.validate_int v; @total_time = v; end
def total_time=(v)
Axlsx.validate_int v
@total_time = v
end
alias :TotalTime= :total_time=

# Sets the hidden_slides property of your app.xml file
def hidden_slides=(v) Axlsx.validate_int v; @hidden_slides = v; end
def hidden_slides=(v)
Axlsx.validate_int v
@hidden_slides = v
end
alias :HiddenSlides= :hidden_slides=

# Sets the m_m_clips property of your app.xml file
def m_m_clips=(v) Axlsx.validate_int v; @m_m_clips = v; end
def m_m_clips=(v)
Axlsx.validate_int v
@m_m_clips = v
end
alias :MMClips= :m_m_clips=

# Sets the scale_crop property of your app.xml file
def scale_crop=(v) Axlsx.validate_boolean v; @scale_crop = v; end
def scale_crop=(v)
Axlsx.validate_boolean v
@scale_crop = v
end
alias :ScaleCrop= :scale_crop=

# Sets the links_up_to_date property of your app.xml file
def links_up_to_date=(v) Axlsx.validate_boolean v; @links_up_to_date = v; end
def links_up_to_date=(v)
Axlsx.validate_boolean v
@links_up_to_date = v
end
alias :LinksUpToDate= :links_up_to_date=

# Sets the characters_with_spaces property of your app.xml file
def characters_with_spaces=(v) Axlsx.validate_int v; @characters_with_spaces = v; end
def characters_with_spaces=(v)
Axlsx.validate_int v
@characters_with_spaces = v
end
alias :CharactersWithSpaces= :characters_with_spaces=

# Sets the share_doc property of your app.xml file
def shared_doc=(v) Axlsx.validate_boolean v; @shared_doc = v; end
def shared_doc=(v)
Axlsx.validate_boolean v
@shared_doc = v
end
alias :SharedDoc= :shared_doc=

# Sets the hyperlink_base property of your app.xml file
def hyperlink_base=(v) Axlsx.validate_string v; @hyperlink_base = v; end
def hyperlink_base=(v)
Axlsx.validate_string v
@hyperlink_base = v
end
alias :HyperlinkBase= :hyperlink_base=

# Sets the HyperLinksChanged property of your app.xml file
def hyperlinks_changed=(v) Axlsx.validate_boolean v; @hyperlinks_changed = v; end
def hyperlinks_changed=(v)
Axlsx.validate_boolean v
@hyperlinks_changed = v
end
alias :HyperLinksChanged= :hyperlinks_changed=

# Sets the app_version property of your app.xml file
def app_version=(v) Axlsx.validate_string v; @app_version = v; end
def app_version=(v)
Axlsx.validate_string v
@app_version = v
end
alias :AppVersion= :app_version=

# Sets the doc_security property of your app.xml file
def doc_security=(v) Axlsx.validate_int v; @doc_security = v; end
def doc_security=(v)
Axlsx.validate_int v
@doc_security = v
end
alias :DocSecurity= :doc_security=

# Serialize the app.xml document
Expand Down
10 changes: 8 additions & 2 deletions lib/axlsx/drawing/area_series.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ def to_xml_string(str = +'')
private

# assigns the data for this series
def data=(v) DataTypeValidator.validate "Series.data", [NumDataSource], v; @data = v; end
def data=(v)
DataTypeValidator.validate "Series.data", [NumDataSource], v
@data = v
end

# assigns the labels for this series
def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end
def labels=(v)
DataTypeValidator.validate "Series.labels", [AxDataSource], v
@labels = v
end
end
end
30 changes: 24 additions & 6 deletions lib/axlsx/drawing/axis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,29 +99,47 @@ def cross_axis=(axis)

# The position of the axis
# must be one of [:l, :r, :t, :b]
def ax_pos=(v) RestrictionValidator.validate "#{self.class}.ax_pos", [:l, :r, :b, :t], v; @ax_pos = v; end
def ax_pos=(v)
RestrictionValidator.validate "#{self.class}.ax_pos", [:l, :r, :b, :t], v
@ax_pos = v
end
alias :axPos= :ax_pos=

# the position of the tick labels
# must be one of [:nextTo, :high, :low1]
def tick_lbl_pos=(v) RestrictionValidator.validate "#{self.class}.tick_lbl_pos", [:nextTo, :high, :low, :none], v; @tick_lbl_pos = v; end
def tick_lbl_pos=(v)
RestrictionValidator.validate "#{self.class}.tick_lbl_pos", [:nextTo, :high, :low, :none], v
@tick_lbl_pos = v
end
alias :tickLblPos= :tick_lbl_pos=

# The number format format code for this axis
# default :General
def format_code=(v) Axlsx.validate_string(v); @format_code = v; end
def format_code=(v)
Axlsx.validate_string(v)
@format_code = v
end

# Specify if gridlines should be shown for this axis
# default true
def gridlines=(v) Axlsx.validate_boolean(v); @gridlines = v; end
def gridlines=(v)
Axlsx.validate_boolean(v)
@gridlines = v
end

# Specify if axis should be removed from the chart
# default false
def delete=(v) Axlsx.validate_boolean(v); @delete = v; end
def delete=(v)
Axlsx.validate_boolean(v)
@delete = v
end

# specifies how the perpendicular axis is crossed
# must be one of [:autoZero, :min, :max]
def crosses=(v) RestrictionValidator.validate "#{self.class}.crosses", [:autoZero, :min, :max], v; @crosses = v; end
def crosses=(v)
RestrictionValidator.validate "#{self.class}.crosses", [:autoZero, :min, :max], v
@crosses = v
end

# Specify the degree of label rotation to apply to labels
# default true
Expand Down
15 changes: 12 additions & 3 deletions lib/axlsx/drawing/bar_series.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def initialize(chart, options = {})
end

# @see colors
def colors=(v) DataTypeValidator.validate "BarSeries.colors", [Array], v; @colors = v end
def colors=(v)
DataTypeValidator.validate "BarSeries.colors", [Array], v
@colors = v
end

def series_color=(v)
@series_color = v
Expand Down Expand Up @@ -85,9 +88,15 @@ def to_xml_string(str = +'')
private

# assigns the data for this series
def data=(v) DataTypeValidator.validate "Series.data", [NumDataSource], v; @data = v; end
def data=(v)
DataTypeValidator.validate "Series.data", [NumDataSource], v
@data = v
end

# assigns the labels for this series
def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end
def labels=(v)
DataTypeValidator.validate "Series.labels", [AxDataSource], v
@labels = v
end
end
end
25 changes: 20 additions & 5 deletions lib/axlsx/drawing/cat_axis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,39 @@ def initialize(options = {})
LBL_OFFSET_REGEX = /0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)/.freeze

# @see tick_lbl_skip
def tick_lbl_skip=(v) Axlsx.validate_unsigned_int(v); @tick_lbl_skip = v; end
def tick_lbl_skip=(v)
Axlsx.validate_unsigned_int(v)
@tick_lbl_skip = v
end
alias :tickLblSkip= :tick_lbl_skip=

# @see tick_mark_skip
def tick_mark_skip=(v) Axlsx.validate_unsigned_int(v); @tick_mark_skip = v; end
def tick_mark_skip=(v)
Axlsx.validate_unsigned_int(v)
@tick_mark_skip = v
end
alias :tickMarkSkip= :tick_mark_skip=

# From the docs: This element specifies that this axis is a date or text axis based on the data that is used for the axis labels, not a specific choice.
def auto=(v) Axlsx.validate_boolean(v); @auto = v; end
def auto=(v)
Axlsx.validate_boolean(v)
@auto = v
end

# specifies how the perpendicular axis is crossed
# must be one of [:ctr, :l, :r]
def lbl_algn=(v) RestrictionValidator.validate "#{self.class}.lbl_algn", [:ctr, :l, :r], v; @lbl_algn = v; end
def lbl_algn=(v)
RestrictionValidator.validate "#{self.class}.lbl_algn", [:ctr, :l, :r], v
@lbl_algn = v
end
alias :lblAlgn= :lbl_algn=

# The offset of the labels
# must be between a string between 0 and 1000
def lbl_offset=(v) RegexValidator.validate "#{self.class}.lbl_offset", LBL_OFFSET_REGEX, v; @lbl_offset = v; end
def lbl_offset=(v)
RegexValidator.validate "#{self.class}.lbl_offset", LBL_OFFSET_REGEX, v
@lbl_offset = v
end
alias :lblOffset= :lbl_offset=

# Serializes the object
Expand Down
Loading

0 comments on commit f593132

Please sign in to comment.