From 88deade39a6a63d813abb82586b9fc6e606d3fd1 Mon Sep 17 00:00:00 2001 From: Malik Parvez <84777619+malikparvez@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:17:34 +0530 Subject: [PATCH 01/46] CONT-1219 : fail ci for puppetlabs members if no label --- .github/workflows/labeller.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml index 5434d3fff..ee149bf52 100644 --- a/.github/workflows/labeller.yml +++ b/.github/workflows/labeller.yml @@ -1,22 +1,27 @@ -name: community-labeller +name: Labeller on: issues: types: - opened + - labeled + - unlabeled pull_request_target: types: - opened + - labeled + - unlabeled jobs: label: runs-on: ubuntu-latest steps: - - uses: puppetlabs/community-labeller@v0 + - uses: puppetlabs/community-labeller@v1.0.1 name: Label issues or pull requests with: label_name: community label_color: '5319e7' org_membership: puppetlabs + fail_if_member: 'true' token: ${{ secrets.IAC_COMMUNITY_LABELER }} From e6b70be9e7a4eaaf50d7eaf8d8172649b6350dcb Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Thu, 27 Jul 2023 09:48:16 +0100 Subject: [PATCH 02/46] (maint) - fix rubocop --- lib/puppet-strings/yard/tags/overload_tag.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet-strings/yard/tags/overload_tag.rb b/lib/puppet-strings/yard/tags/overload_tag.rb index 8ae294250..2459e0cc1 100644 --- a/lib/puppet-strings/yard/tags/overload_tag.rb +++ b/lib/puppet-strings/yard/tags/overload_tag.rb @@ -75,8 +75,8 @@ def object=(value) # @param [Array] args The args passed to the method. # @param block The block passed to the method. # @return Returns what the method call on the object would return. - def method_missing(method_name, *args, &block) - return object.send(method_name, *args, &block) if object.respond_to? method_name + def method_missing(method_name, ...) + return object.send(method_name, ...) if object.respond_to? method_name super end From 77171556479f88961fd00c1ea1c9adc5cb9a3180 Mon Sep 17 00:00:00 2001 From: Sean Millichamp Date: Fri, 4 Aug 2023 11:20:31 -0400 Subject: [PATCH 03/46] Fix option tag handling with no data types Do not error if no data types are provided to the option tag. Instead, generate a suitable line excluding the data type. --- lib/puppet-strings/markdown/templates/classes_and_defines.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/puppet-strings/markdown/templates/classes_and_defines.erb b/lib/puppet-strings/markdown/templates/classes_and_defines.erb index 805e227b1..636ab60ce 100644 --- a/lib/puppet-strings/markdown/templates/classes_and_defines.erb +++ b/lib/puppet-strings/markdown/templates/classes_and_defines.erb @@ -70,7 +70,11 @@ Data type:<%= code_maybe_block(param[:types].join(', ')) %> Options: <% options_for_param(param[:name]).each do |o| -%> +<% if o[:opt_types] -%> * **<%= o[:opt_name] %>** `<%= o[:opt_types][0] %>`: <%= o[:opt_text] %> +<% else -%> +* **<%= o[:opt_name] %>**: <%= o[:opt_text] %> +<% end -%> <% end -%> <% end -%> From 134db6e749066d97d38debc99e250f63a1a28a2c Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Wed, 9 Aug 2023 16:33:20 +0100 Subject: [PATCH 04/46] (maint) - Use tooling mend workflow --- .github/workflows/mend.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml index b4100a5af..095e9e591 100644 --- a/.github/workflows/mend.yml +++ b/.github/workflows/mend.yml @@ -11,5 +11,5 @@ on: jobs: mend: - uses: "puppetlabs/cat-github-actions/.github/workflows/mend_ruby.yml@main" + uses: "puppetlabs/cat-github-actions/.github/workflows/tooling_mend_ruby.yml@main" secrets: "inherit" From c8fe5cc14134ebdcbe4fdc3d1ec2068bd816e8a7 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Wed, 16 Aug 2023 16:35:27 +0100 Subject: [PATCH 05/46] (CAT-1320) Update CODEOWNERS Prior to this commit ownership sat with modules. We are working on rolling out ownership for tools to the tooling team. --- CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index b52a231d2..57ffcb9b7 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1,2 @@ -* @puppetlabs/modules +# Setting ownership to the tooling team +* @puppetlabs/tooling From 674e8f51543747be2772cbecc4556a537ab9ff5d Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Tue, 12 Sep 2023 17:30:23 +0100 Subject: [PATCH 06/46] (CAT-1404) - Regenerate .rubocop_todo.yml Signed-off-by: Gavin Didrichsen --- .rubocop_todo.yml | 69 +++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b91c658bc..998d705ed 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,20 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-13 12:45:07 UTC using RuboCop version 1.50.1. +# on 2023-09-12 16:29:51 UTC using RuboCop version 1.56.3. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -Naming/FileName: - Exclude: - - 'lib/puppet-strings.rb' - -Naming/MethodName: - Exclude: - - 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb' - - 'lib/puppet-strings/yard/parsers/puppet/parser.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Severity, Include. @@ -23,16 +14,16 @@ Gemspec/RequireMFA: Exclude: - 'puppet-strings.gemspec' -# Offense count: 46 +# Offense count: 45 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 98 + Max: 95 -# Offense count: 11 +# Offense count: 10 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. # AllowedMethods: refine Metrics/BlockLength: - Max: 119 + Max: 44 # Offense count: 1 # Configuration parameters: CountBlocks. @@ -44,23 +35,23 @@ Metrics/BlockNesting: Metrics/ClassLength: Max: 283 -# Offense count: 33 +# Offense count: 34 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 36 -# Offense count: 44 +# Offense count: 42 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 75 -# Offense count: 2 +# Offense count: 3 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: MaxOptionalParameters: 5 Max: 10 -# Offense count: 28 +# Offense count: 29 # Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 37 @@ -71,6 +62,14 @@ Naming/AccessorMethodName: - 'lib/puppet-strings/yard/handlers/puppet/base.rb' - 'lib/puppet-strings/yard/handlers/ruby/type_base.rb' +# Offense count: 1 +# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. +# CheckDefinitionPathHierarchyRoots: lib, spec, test, src +# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS +Naming/FileName: + Exclude: + - 'lib/puppet-strings.rb' + # Offense count: 1 # Configuration parameters: ForbiddenDelimiters. # ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$)) @@ -78,6 +77,12 @@ Naming/HeredocDelimiterNaming: Exclude: - 'spec/acceptance/generate_markdown_spec.rb' +# Offense count: 24 +# Configuration parameters: AllowedPatterns. +# SupportedStyles: snake_case, camelCase +Naming/MethodName: + EnforcedStyle: snake_case + # Offense count: 24 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to @@ -96,9 +101,9 @@ Performance/CollectionLiteralInLoop: # Offense count: 1 RSpec/BeforeAfterAll: Exclude: - - 'spec/spec_helper.rb' - - 'spec/rails_helper.rb' - - 'spec/support/**/*.rb' + - '**/spec/spec_helper.rb' + - '**/spec/rails_helper.rb' + - '**/spec/support/**/*.rb' - 'spec/acceptance/running_strings_generate_spec.rb' # Offense count: 7 @@ -124,7 +129,7 @@ RSpec/DescribeClass: - 'spec/acceptance/generate_markdown_spec.rb' - 'spec/acceptance/running_strings_generate_spec.rb' -# Offense count: 48 +# Offense count: 51 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 66 @@ -134,12 +139,6 @@ RSpec/ExpectInHook: Exclude: - 'spec/unit/puppet-strings/json_spec.rb' -# Offense count: 20 -# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. -# Include: **/*_spec*rb*, **/spec/**/* -RSpec/FilePath: - Enabled: false - # Offense count: 91 RSpec/MultipleExpectations: Max: 64 @@ -154,24 +153,30 @@ RSpec/RepeatedExampleGroupDescription: Exclude: - 'spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb' +# Offense count: 20 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. +# Include: **/*_spec.rb +RSpec/SpecFilePathFormat: + Enabled: false + # Offense count: 1 Style/ClassVars: Exclude: - 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb' # Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). Style/CombinableLoops: Exclude: - 'lib/puppet-strings/markdown.rb' - 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb' - - 'lib/puppet-strings/tasks/generate.rb' # Offense count: 1 Style/MixinUsage: Exclude: - 'spec/acceptance/running_strings_generate_spec.rb' -# Offense count: 17 +# Offense count: 20 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? Style/OptionalBooleanParameter: @@ -190,9 +195,9 @@ Style/OptionalBooleanParameter: - 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb' - 'lib/puppet-strings/yard/handlers/ruby/function_handler.rb' -# Offense count: 139 +# Offense count: 136 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: - Max: 200 + Max: 199 From 6718f5b3760ed1d49a14f8aedae7a206e06ac33b Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Tue, 12 Sep 2023 18:05:30 +0100 Subject: [PATCH 07/46] Ignore the rubocop Naming/MethodName violation. Signed-off-by: Gavin Didrichsen --- lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb | 3 +++ lib/puppet-strings/yard/parsers/puppet/parser.rb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb b/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb index 7268d4661..20c856926 100644 --- a/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb +++ b/lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb @@ -143,6 +143,8 @@ def literal(ast) @literal_visitor.visit_this_0(self, ast) end + # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines + # rubocop:disable Naming/MethodName # ----- The following methods are different/additions from the original Literal_evaluator def literal_Object(o) # Ignore any other object types @@ -214,6 +216,7 @@ def literal_LiteralHash(o) result[literal(entry.key)] = literal(entry.value) end end + # rubocop:enable Naming/MethodName end # Extracts the datatype attributes from a Puppet Data Type interface hash. diff --git a/lib/puppet-strings/yard/parsers/puppet/parser.rb b/lib/puppet-strings/yard/parsers/puppet/parser.rb index 98f4e3029..7d227bfd4 100644 --- a/lib/puppet-strings/yard/parsers/puppet/parser.rb +++ b/lib/puppet-strings/yard/parsers/puppet/parser.rb @@ -40,6 +40,8 @@ def enumerator private + # TODO: Fix the rubocop violations in this file between the following rubocop:disable/enable lines + # rubocop:disable Naming/MethodName def transform_Program(o) # Cache the lines of the source text; we'll use this to locate comments @lines = o.source_text.lines.to_a @@ -83,4 +85,5 @@ def transform_TypeAlias(o) def transform_Object(o) # Ignore anything else (will be compacted out of the resulting array) end + # rubocop:enable Naming/MethodName end From 151b156ef8f9452a1b3be0c70b6b908dbc896aa0 Mon Sep 17 00:00:00 2001 From: Gavin Patton Date: Tue, 19 Sep 2023 09:56:58 +0100 Subject: [PATCH 08/46] "Adding codeowners --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a04f2116..a8ce93479 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Puppet strings -[![ci](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml/badge.svg)](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml) [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings) +[![ci](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml/badge.svg)](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml) +[![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings) +[![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/pdk/blob/main/CODEOWNERS) Puppet Strings generates documentation for Puppet code and extensions written in Puppet and Ruby. Strings processes code and YARD-style code comments to create documentation in HTML, Markdown, or JSON formats. From 04c52afaab4e8c1a47a4a0f8ac6ea0f7a55b4812 Mon Sep 17 00:00:00 2001 From: Gavin Patton Date: Tue, 19 Sep 2023 15:49:53 +0100 Subject: [PATCH 09/46] "Fixing readme badge link" --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8ce93479..61f5e4fe9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![ci](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml/badge.svg)](https://github.com/puppetlabs/puppet-strings/actions/workflows/ci.yml) [![Gem Version](https://badge.fury.io/rb/puppet-strings.svg)](https://badge.fury.io/rb/puppet-strings) -[![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/pdk/blob/main/CODEOWNERS) +[![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/puppet-strings/blob/main/CODEOWNERS) Puppet Strings generates documentation for Puppet code and extensions written in Puppet and Ruby. Strings processes code and YARD-style code comments to create documentation in HTML, Markdown, or JSON formats. From 3710cfdd11e363771fa6013e89dd98ed8773b03f Mon Sep 17 00:00:00 2001 From: Gavin Patton Date: Mon, 25 Sep 2023 09:41:13 +0100 Subject: [PATCH 10/46] (MAINT) Disable spec suffix cop which has wrongly raised errors in spec tests --- .rubocop_todo.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 998d705ed..117a61ce3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-09-12 16:29:51 UTC using RuboCop version 1.56.3. +# on 2023-09-25 08:38:34 UTC using RuboCop version 1.56.3. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -77,12 +77,6 @@ Naming/HeredocDelimiterNaming: Exclude: - 'spec/acceptance/generate_markdown_spec.rb' -# Offense count: 24 -# Configuration parameters: AllowedPatterns. -# SupportedStyles: snake_case, camelCase -Naming/MethodName: - EnforcedStyle: snake_case - # Offense count: 24 # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to @@ -139,6 +133,12 @@ RSpec/ExpectInHook: Exclude: - 'spec/unit/puppet-strings/json_spec.rb' +# Offense count: 20 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. +# Include: **/*_spec*rb*, **/spec/**/* +RSpec/FilePath: + Enabled: false + # Offense count: 91 RSpec/MultipleExpectations: Max: 64 From 650520cf7b16fa9d4ebfd2b7ad953b29db783df7 Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 12 Oct 2023 19:10:46 +0100 Subject: [PATCH 11/46] (maint) - Removed soon-to-be deprecated RSpec/FilePath cops Signed-off-by: Gavin Didrichsen --- .rubocop.yml | 8 ++++++++ .rubocop_todo.yml | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2ccc89f3d..06ba896ac 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -17,3 +17,11 @@ AllCops: # Disabled Style/ClassAndModuleChildren: Enabled: false + +#################################################### +# Cops below here due for deprecation +#################################################### +# ``Rspec/FilePath`` is going to be deprecated in the next major release of rubocop >=3.0.0: see +# As the new cops are already present, e.g., Rspec/SpecFilePathPathFormat, then disabling this in preparation +RSpec/FilePath: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 117a61ce3..2a307f1a1 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -133,12 +133,6 @@ RSpec/ExpectInHook: Exclude: - 'spec/unit/puppet-strings/json_spec.rb' -# Offense count: 20 -# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. -# Include: **/*_spec*rb*, **/spec/**/* -RSpec/FilePath: - Enabled: false - # Offense count: 91 RSpec/MultipleExpectations: Max: 64 From 336583e02ed3372e823623fffaa7668069f70a24 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Tue, 17 Oct 2023 17:13:53 +0100 Subject: [PATCH 12/46] (CAT-1529) Update README.md LICENSE section --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 61f5e4fe9..87efc885e 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,10 @@ An example of running the acceptance tests locally with Docker: bundle exec rake litmus:tear_down ``` +## License + +This codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT. + ## Support Please log issues in [GitHub issues](https://github.com/puppetlabs/puppet-strings/issues). From ce55aa6264715a063e319cf84b214bda429334ed Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 22 Nov 2023 11:47:21 +0000 Subject: [PATCH 13/46] Release prep v4.1.1 --- CHANGELOG.md | 36 +++++++++++++++++++++-------------- lib/puppet-strings/version.rb | 2 +- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0cb2ad2a..95c51100d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v4.1.1](https://github.com/puppetlabs/puppet-strings/tree/v4.1.1) - 2023-11-22 + +[Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.0...v4.1.1) + +### Fixed + +- Fix option tag handling with no data types [#361](https://github.com/puppetlabs/puppet-strings/pull/361) ([seanmil](https://github.com/seanmil)) + ## [v4.1.0](https://github.com/puppetlabs/puppet-strings/tree/v4.1.0) - 2023-07-04 [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.0.0...v4.1.0) @@ -21,13 +29,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v3.0.1...v4.0.0.rc.1) +### Changed +- (CONT-812) Puppet 8 / Ruby 3 support [#348](https://github.com/puppetlabs/puppet-strings/pull/348) ([chelnak](https://github.com/chelnak)) + ### Added - Add deprecated tag [#342](https://github.com/puppetlabs/puppet-strings/pull/342) ([b4ldr](https://github.com/b4ldr)) -### Changed -- (CONT-812) Puppet 8 / Ruby 3 support [#348](https://github.com/puppetlabs/puppet-strings/pull/348) ([chelnak](https://github.com/chelnak)) - ## [v3.0.1](https://github.com/puppetlabs/puppet-strings/tree/v3.0.1) - 2022-10-25 [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v3.0.0...v3.0.1) @@ -40,16 +48,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.9.0...v3.0.0) -### Added - -- (#223) Use code blocks as appropriate in Markdown [#319](https://github.com/puppetlabs/puppet-strings/pull/319) ([danielparks](https://github.com/danielparks)) -- Use tilde heredocs for readability [#317](https://github.com/puppetlabs/puppet-strings/pull/317) ([danielparks](https://github.com/danielparks)) - ### Changed - (CONT-228) Remove deprecated emit flags [#329](https://github.com/puppetlabs/puppet-strings/pull/329) ([chelnak](https://github.com/chelnak)) - (CONT-228) Bump ruby version [#326](https://github.com/puppetlabs/puppet-strings/pull/326) ([chelnak](https://github.com/chelnak)) - (#301) Update minimum Ruby version to 2.5.0 [#313](https://github.com/puppetlabs/puppet-strings/pull/313) ([danielparks](https://github.com/danielparks)) +### Added + +- (#223) Use code blocks as appropriate in Markdown [#319](https://github.com/puppetlabs/puppet-strings/pull/319) ([danielparks](https://github.com/danielparks)) +- Use tilde heredocs for readability [#317](https://github.com/puppetlabs/puppet-strings/pull/317) ([danielparks](https://github.com/danielparks)) + ### Fixed - (#240) Fix output of default values that are expressions [#315](https://github.com/puppetlabs/puppet-strings/pull/315) ([danielparks](https://github.com/danielparks)) @@ -96,13 +104,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.5.0...v2.6.0) +### Changed +- (MAINT) Drop Ruby 2.1.x and Puppet 4.x compatibility [#253](https://github.com/puppetlabs/puppet-strings/pull/253) ([scotje](https://github.com/scotje)) + ### Added - Improved markdown templates [#252](https://github.com/puppetlabs/puppet-strings/pull/252) ([kozl](https://github.com/kozl)) -### Changed -- (MAINT) Drop Ruby 2.1.x and Puppet 4.x compatibility [#253](https://github.com/puppetlabs/puppet-strings/pull/253) ([scotje](https://github.com/scotje)) - ### Fixed - Do not fail in case return tag has no type specified [#268](https://github.com/puppetlabs/puppet-strings/pull/268) ([tiandrey](https://github.com/tiandrey)) @@ -189,15 +197,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/1.2.1...2.0.0) +### Changed +- bump required ruby and puppet versions [#178](https://github.com/puppetlabs/puppet-strings/pull/178) ([eputnam](https://github.com/eputnam)) + ### Added - (PDOC-238) add generated message to markdown [#175](https://github.com/puppetlabs/puppet-strings/pull/175) ([eputnam](https://github.com/eputnam)) - (PDOC-228) puppet plan support [#168](https://github.com/puppetlabs/puppet-strings/pull/168) ([eputnam](https://github.com/eputnam)) - (PDOC-206) support for tasks [#161](https://github.com/puppetlabs/puppet-strings/pull/161) ([eputnam](https://github.com/eputnam)) -### Changed -- bump required ruby and puppet versions [#178](https://github.com/puppetlabs/puppet-strings/pull/178) ([eputnam](https://github.com/eputnam)) - ### Fixed - (PDOC-36) fix hack for README urls [#176](https://github.com/puppetlabs/puppet-strings/pull/176) ([eputnam](https://github.com/eputnam)) diff --git a/lib/puppet-strings/version.rb b/lib/puppet-strings/version.rb index bfc685fcf..da3c432ba 100644 --- a/lib/puppet-strings/version.rb +++ b/lib/puppet-strings/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module PuppetStrings - VERSION = '4.1.0' + VERSION = '4.1.1' end From e3a9bfd6df75f8ae62c8ebc37ca899fe0851d2c0 Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Mon, 4 Dec 2023 21:30:53 +0000 Subject: [PATCH 14/46] Fix rubocop lint warnings Signed-off-by: Gavin Didrichsen --- lib/puppet-strings/describe.rb | 2 +- lib/puppet-strings/yard/code_objects/function.rb | 2 +- lib/puppet-strings/yard/code_objects/provider.rb | 2 +- lib/puppet-strings/yard/code_objects/type.rb | 2 +- lib/puppet-strings/yard/util.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet-strings/describe.rb b/lib/puppet-strings/describe.rb index 6c09f14b2..acddd244b 100644 --- a/lib/puppet-strings/describe.rb +++ b/lib/puppet-strings/describe.rb @@ -66,7 +66,7 @@ def self.list_one(object) targetlength = 48 shortento = targetlength - 4 contentstring = object[:docstring][:text] - end_of_line = contentstring.index("\n") # "." gives closer results to old describeb, but breaks for '.k5login' + end_of_line = contentstring.index("\n") # "." gives closer results to old describeb, but breaks for '.k5login' contentstring = contentstring[0..end_of_line] unless end_of_line.nil? contentstring = "#{contentstring[0..shortento]} ..." if contentstring.length > targetlength diff --git a/lib/puppet-strings/yard/code_objects/function.rb b/lib/puppet-strings/yard/code_objects/function.rb index e2f9007ec..03916a081 100644 --- a/lib/puppet-strings/yard/code_objects/function.rb +++ b/lib/puppet-strings/yard/code_objects/function.rb @@ -8,7 +8,7 @@ class PuppetStrings::Yard::CodeObjects::Functions < PuppetStrings::Yard::CodeObj # @param [Symbol] type The function type to get the group for. # @return Returns the singleton instance of the group. def self.instance(type) - super("puppet_functions_#{type}".to_sym) + super(:"puppet_functions_#{type}") end # Gets the display name of the group. diff --git a/lib/puppet-strings/yard/code_objects/provider.rb b/lib/puppet-strings/yard/code_objects/provider.rb index 47e6ad5b6..2fc8135c5 100644 --- a/lib/puppet-strings/yard/code_objects/provider.rb +++ b/lib/puppet-strings/yard/code_objects/provider.rb @@ -8,7 +8,7 @@ class PuppetStrings::Yard::CodeObjects::Providers < PuppetStrings::Yard::CodeObj # @param [String] type The resource type name for the provider. # @return Returns the singleton instance of the group. def self.instance(type) - super("puppet_providers_#{type}".to_sym) + super(:"puppet_providers_#{type}") end # Gets the display name of the group. diff --git a/lib/puppet-strings/yard/code_objects/type.rb b/lib/puppet-strings/yard/code_objects/type.rb index fe6131fdd..3bbc95e26 100644 --- a/lib/puppet-strings/yard/code_objects/type.rb +++ b/lib/puppet-strings/yard/code_objects/type.rb @@ -169,7 +169,7 @@ def parameters # render-time. For now, this should re-resolve on every call. # may be able to memoize this def providers - providers = YARD::Registry.all("puppet_providers_#{name}".to_sym) + providers = YARD::Registry.all(:"puppet_providers_#{name}") return providers if providers.empty? providers.first.children diff --git a/lib/puppet-strings/yard/util.rb b/lib/puppet-strings/yard/util.rb index ecf4b6e50..8025b150d 100644 --- a/lib/puppet-strings/yard/util.rb +++ b/lib/puppet-strings/yard/util.rb @@ -35,7 +35,7 @@ def self.github_to_yard_links(data) # @return [Array] Returns an array of tag hashes. def self.tags_to_hashes(tags) # Skip over the API tags that are public - tags.select { |t| (t.tag_name != 'api' || t.text != 'public') }.map do |t| + tags.select { |t| t.tag_name != 'api' || t.text != 'public' }.map do |t| next t.to_hash if t.respond_to?(:to_hash) tag = { tag_name: t.tag_name } From 06d04ba37c8dd4a9964ed8bd35c669ea2a6b67a4 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Tue, 5 Dec 2023 08:32:08 +0000 Subject: [PATCH 15/46] Revert "(maint) - fix rubocop" This reverts commit e6b70be9e7a4eaaf50d7eaf8d8172649b6350dcb. --- lib/puppet-strings/yard/tags/overload_tag.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet-strings/yard/tags/overload_tag.rb b/lib/puppet-strings/yard/tags/overload_tag.rb index 2459e0cc1..8ae294250 100644 --- a/lib/puppet-strings/yard/tags/overload_tag.rb +++ b/lib/puppet-strings/yard/tags/overload_tag.rb @@ -75,8 +75,8 @@ def object=(value) # @param [Array] args The args passed to the method. # @param block The block passed to the method. # @return Returns what the method call on the object would return. - def method_missing(method_name, ...) - return object.send(method_name, ...) if object.respond_to? method_name + def method_missing(method_name, *args, &block) + return object.send(method_name, *args, &block) if object.respond_to? method_name super end From 95307abda98647fa032f93d1bcd21908e264551e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 5 Dec 2023 09:02:28 +0000 Subject: [PATCH 16/46] Release prep v4.1.2 --- CHANGELOG.md | 8 ++++++++ lib/puppet-strings/version.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95c51100d..d1fea3eec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v4.1.2](https://github.com/puppetlabs/puppet-strings/tree/v4.1.2) - 2023-12-05 + +[Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.1...v4.1.2) + +### Fixed + +- Revert "(maint) - fix rubocop" Leading argument with delegation syntax not supported with ruby 2.7.0 [#376](https://github.com/puppetlabs/puppet-strings/pull/376) ([jordanbreen28](https://github.com/jordanbreen28)) + ## [v4.1.1](https://github.com/puppetlabs/puppet-strings/tree/v4.1.1) - 2023-11-22 [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.0...v4.1.1) diff --git a/lib/puppet-strings/version.rb b/lib/puppet-strings/version.rb index da3c432ba..619b4b942 100644 --- a/lib/puppet-strings/version.rb +++ b/lib/puppet-strings/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module PuppetStrings - VERSION = '4.1.1' + VERSION = '4.1.2' end From 79a4bb7cacb2457909b511fa76371a38c1575851 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 4 Jan 2024 12:56:54 +0100 Subject: [PATCH 17/46] Drop redundant check for Ruby 1.9+ Since aef17296fa073139453778b8f1ca80ba3a6824f5 the required Ruby version is 1.9.3 so this shouldn't install on Ruby 1.8 at all anymore. These days you won't find Ruby 1.8 unless you try very hard so it can be dropped safely. Fixes: aef17296fa07 ("(PDOC-119) Add required ruby version to gemspec") --- lib/puppet/face/strings.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/puppet/face/strings.rb b/lib/puppet/face/strings.rb index 470262584..5d5e56c22 100644 --- a/lib/puppet/face/strings.rb +++ b/lib/puppet/face/strings.rb @@ -144,7 +144,6 @@ def check_required_features raise "The 'yard' gem must be installed in order to use this face." unless Puppet.features.yard? raise "The 'rgen' gem must be installed in order to use this face." unless Puppet.features.rgen? - raise 'This face requires Ruby 1.9 or greater.' if RUBY_VERSION.match?(/^1\.8/) end # Builds the options to PuppetStrings.generate. From 3cbed729377e66725ab65959284fc2ccc155003d Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 4 Jan 2024 12:59:36 +0100 Subject: [PATCH 18/46] Drop empty Ruby version check This specific code has gone through some odd refactoring. In d7f5e446476d39e04c607b6a7a189616ad6061ad both branches of the if condition were made the same, which was then refactored into an empty unless condition in 10fd31e529772c8ed977157407321bb2318dc389. But 77150635f54370e33dbe540ca295a1d49061ac22 raised the minimum version to 2.7 so that should have simply removed the whole version check. Fixes: 77150635f543 ("(MAINT) Bump minumum ruby version") --- lib/puppet-strings/markdown.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/puppet-strings/markdown.rb b/lib/puppet-strings/markdown.rb index 401227965..3abd43a09 100644 --- a/lib/puppet-strings/markdown.rb +++ b/lib/puppet-strings/markdown.rb @@ -76,9 +76,6 @@ def self.render(path = nil) # @param [String] path The full path to the template file. # @return [ERB] Template def self.erb(path) - unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.6.0') - # This outputs warnings in Ruby 2.6+. - end ERB.new(File.read(path), trim_mode: '-') end end From 4c5280e52706a3a3b40150b7cf0f063197d7e545 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Mon, 15 Jan 2024 13:59:02 +0000 Subject: [PATCH 19/46] "(CAT-1618) - Add code coverage to ci" --- .github/workflows/ci.yml | 4 ++++ Gemfile | 1 + Rakefile | 9 +++++++++ spec/spec_helper.rb | 11 +++++++---- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index feec48d3f..615148b5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: - "main" workflow_dispatch: +env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + jobs: spec: strategy: @@ -26,6 +29,7 @@ jobs: uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" secrets: "inherit" with: + rake_task: "spec:coverage" ruby_version: ${{ matrix.ruby_version }} puppet_gem_version: ${{ matrix.puppet_gem_version }} runs_on: ${{ matrix.runs_on }} diff --git a/Gemfile b/Gemfile index 5cf8c0a3c..4cea4dd9c 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,7 @@ group :development do gem 'serverspec' gem 'simplecov', require: false gem 'simplecov-console', require: false + gem 'codecov', require: false gem 'redcarpet' end diff --git a/Rakefile b/Rakefile index 9a7c6f9c8..0e55d3650 100644 --- a/Rakefile +++ b/Rakefile @@ -15,6 +15,15 @@ RSpec::Core::RakeTask.new(:spec) do |t| t.exclude_pattern = "spec/acceptance/**/*.rb" end +namespace :spec do + desc 'Run RSpec code examples with coverage collection' + task :coverage do + ENV['COVERAGE'] = 'yes' + Rake::Task['spec'].execute + end +end + + RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = "spec/unit/**/*.rb" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fc3c86fea..67402308b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,19 +1,22 @@ # frozen_string_literal: true if ENV['COVERAGE'] == 'yes' - require 'codecov' require 'simplecov' require 'simplecov-console' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console, - SimpleCov::Formatter::Codecov + SimpleCov::Formatter::Console ] + if ENV['CI'] == 'true' + require 'codecov' + SimpleCov.formatters << SimpleCov::Formatter::Codecov + end + SimpleCov.start do track_files 'lib/**/*.rb' - + add_filter 'lib/puppet-strings/version.rb' add_filter '/spec' end end From 7a4e59618dec0988a0c4b50344b86f3ccc92c79d Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Mon, 15 Jan 2024 15:35:33 +0000 Subject: [PATCH 20/46] (maint) - Update puppet 8 gem version --- .github/workflows/ci.yml | 2 +- .github/workflows/nightly.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 615148b5f..8b23ac079 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - ruby-version: '2.7' puppet_gem_version: '~> 7.0' - ruby_version: '3.2' - puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8' + puppet_gem_version: '~> 8.0' runs_on: - "ubuntu-latest" - "windows-latest" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index b7af44609..f8aae4760 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,7 +17,7 @@ jobs: - ruby-version: '2.7' puppet_gem_version: '~> 7.0' - ruby_version: '3.2' - puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8' + puppet_gem_version: '~> 8.0' runs_on: - "ubuntu-latest" - "windows-latest" From 9f8cf339c18060bcaf5109578f5495dc3c304fb3 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Fri, 19 Jan 2024 12:23:46 +0000 Subject: [PATCH 21/46] (CAT-1618) - Upload code coverage reports on main --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b23ac079..576a75fec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ name: "ci" on: + push: + branches: + - "main" pull_request: branches: - "main" From 02884a08f6cd6bd37c915d3654ec703ead817f4a Mon Sep 17 00:00:00 2001 From: Ben Ford Date: Thu, 4 Jan 2024 12:25:09 -0800 Subject: [PATCH 22/46] Add new trusted contributor --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 57ffcb9b7..d5cc7cc9f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,2 +1,2 @@ # Setting ownership to the tooling team -* @puppetlabs/tooling +* @puppetlabs/tooling @bastelfreak From 083865a2bb9bd2f5270e4ad2824696219ae5e744 Mon Sep 17 00:00:00 2001 From: Sean Millichamp Date: Fri, 19 Jan 2024 11:53:23 -0500 Subject: [PATCH 23/46] Allow numerics for templates using code_maybe_block A number of ERB templates use the code_maybe_block method to assist with formatting. This fails if the value being passed is not a string, such as an integer default value for a resource type. --- lib/puppet-strings/markdown/helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet-strings/markdown/helpers.rb b/lib/puppet-strings/markdown/helpers.rb index 90a29b322..40885e734 100644 --- a/lib/puppet-strings/markdown/helpers.rb +++ b/lib/puppet-strings/markdown/helpers.rb @@ -12,7 +12,7 @@ module PuppetStrings::Markdown::Helpers # @param [String] inline_prefix String to insert before if it’s inline. # @returns [String] Markdown def code_maybe_block(code, type: :puppet, block_prefix: "\n\n", inline_prefix: ' ') - if code.include?("\n") + if code.to_s.include?("\n") "#{block_prefix}```#{type}\n#{code}\n```" else "#{inline_prefix}`#{code}`" From 672839c0e70638de4aec75cf49f0e79bb0a2a172 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Fri, 1 Dec 2023 15:41:18 +0000 Subject: [PATCH 24/46] (maint) Update CONTRIBUTING.md Removing an old link that no longer works. --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d399a2b3a..f9c4d55da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -124,7 +124,6 @@ To cut a new release, from a current `main` checkout: * Run `rake release[upstream]` to release from your checkout * make sure to use the name of your git remote pointing to the puppetlabs GitHub repo * Remove the release-prep branch -* Send the release announcements using the template in [misc/ANNOUNCEMENT_TEMPLATE.md](misc/ANNOUNCEMENT_TEMPLATE.md) # Additional Resources From 684306ab26bb26d10cd0659011c5944fb88780d6 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Mon, 22 Jan 2024 15:24:09 +0000 Subject: [PATCH 25/46] (CAT-1688) Upgrade rubocop Following a recent team decision, we are implementing a Rubocop Upgrade, moving the version from 1.48.1 to 1.50.0. This should be the final version until Puppet 7 is unsupported. --- .rubocop_todo.yml | 5 ++--- Gemfile | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2a307f1a1..f764d0b10 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-09-25 08:38:34 UTC using RuboCop version 1.56.3. +# on 2024-01-22 15:21:03 UTC using RuboCop version 1.50.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -123,7 +123,7 @@ RSpec/DescribeClass: - 'spec/acceptance/generate_markdown_spec.rb' - 'spec/acceptance/running_strings_generate_spec.rb' -# Offense count: 51 +# Offense count: 48 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 66 @@ -159,7 +159,6 @@ Style/ClassVars: - 'lib/puppet-strings/yard/templates/default/layout/html/setup.rb' # Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). Style/CombinableLoops: Exclude: - 'lib/puppet-strings/markdown.rb' diff --git a/Gemfile b/Gemfile index 4cea4dd9c..a59d8f8ca 100644 --- a/Gemfile +++ b/Gemfile @@ -36,7 +36,7 @@ group :development do gem 'rspec', '~> 3.1' gem 'rspec-its', '~> 1.0' - gem 'rubocop', '~> 1.48', require: false + gem 'rubocop', '~> 1.50.0', require: false gem 'rubocop-performance', '~> 1.16', require: false gem 'rubocop-rspec', '~> 2.19', require: false From 7aa329046cb2984bd5e122a2ba93282348b3ca9a Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Mon, 22 Jan 2024 15:37:32 +0000 Subject: [PATCH 26/46] Addressing LineLength --- .rubocop.yml | 3 +++ .rubocop_todo.yml | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 06ba896ac..d0577de14 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,6 +18,9 @@ AllCops: Style/ClassAndModuleChildren: Enabled: false +Layout/LineLength: + Max: 200 + #################################################### # Cops below here due for deprecation #################################################### diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f764d0b10..d927f4efe 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -187,10 +187,3 @@ Style/OptionalBooleanParameter: - 'lib/puppet-strings/yard/code_objects/type.rb' - 'lib/puppet-strings/yard/handlers/ruby/data_type_handler.rb' - 'lib/puppet-strings/yard/handlers/ruby/function_handler.rb' - -# Offense count: 136 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. -# URISchemes: http, https -Layout/LineLength: - Max: 199 From 0bba2d4c5c0f755e522c446c66b9df001e74bb1e Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Wed, 24 Jan 2024 15:42:47 +0000 Subject: [PATCH 27/46] (CAT-1618) - Remove deprecated codecov gem --- Gemfile | 1 - spec/spec_helper.rb | 5 ----- 2 files changed, 6 deletions(-) diff --git a/Gemfile b/Gemfile index a59d8f8ca..ecc46ab2b 100644 --- a/Gemfile +++ b/Gemfile @@ -43,7 +43,6 @@ group :development do gem 'serverspec' gem 'simplecov', require: false gem 'simplecov-console', require: false - gem 'codecov', require: false gem 'redcarpet' end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 67402308b..8c4b7275c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,11 +9,6 @@ SimpleCov::Formatter::Console ] - if ENV['CI'] == 'true' - require 'codecov' - SimpleCov.formatters << SimpleCov::Formatter::Codecov - end - SimpleCov.start do track_files 'lib/**/*.rb' add_filter 'lib/puppet-strings/version.rb' From 31058901f86c4a93c3004970337b154fefddc8ee Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Thu, 1 Feb 2024 11:41:34 +0000 Subject: [PATCH 28/46] (CAT-770) - Update mend to run on pull_request_target --- .github/workflows/mend.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml index 095e9e591..2ee195997 100644 --- a/.github/workflows/mend.yml +++ b/.github/workflows/mend.yml @@ -1,9 +1,10 @@ name: "mend" on: - pull_request: - branches: - - "main" + pull_request_target: + types: + - opened + - synchronize schedule: - cron: "0 0 * * *" workflow_dispatch: From ce169e45ab3289a40ac8460da331b5c2870360af Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Wed, 7 Feb 2024 15:05:06 +0000 Subject: [PATCH 29/46] Update CODEOWNERS --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index d5cc7cc9f..c16a1318f 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,2 +1,2 @@ # Setting ownership to the tooling team -* @puppetlabs/tooling @bastelfreak +* @puppetlabs/devx @bastelfreak From d750e543c03338489983d1d6ccf1b4627844feac Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Tue, 27 Feb 2024 10:09:35 -0800 Subject: [PATCH 30/46] validate: give hint on how to regenerate outdated REFERENCE.md --- lib/puppet-strings/tasks/validate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet-strings/tasks/validate.rb b/lib/puppet-strings/tasks/validate.rb index 21251d8ce..73b16bfdd 100644 --- a/lib/puppet-strings/tasks/validate.rb +++ b/lib/puppet-strings/tasks/validate.rb @@ -34,7 +34,7 @@ existing = File.read(filename) if generated != existing - warn "#{filename} is outdated" + warn "#{filename} is outdated; to regenerate: bundle exec rake strings:generate:reference" exit 1 end end From c1ae856564d024e44cd25b6472f6d767b8a1d848 Mon Sep 17 00:00:00 2001 From: Paula Muir Date: Fri, 5 Apr 2024 08:38:12 +0100 Subject: [PATCH 31/46] (maint) Address rubocop Prior to this commit, the nightlies were failing due to a change in Rubocop. This PR addresses the failures. --- .../yard/handlers/puppet/class_handler_spec.rb | 6 +++--- .../yard/handlers/puppet/data_type_alias_handler_spec.rb | 2 +- .../yard/handlers/puppet/defined_type_handler_spec.rb | 6 +++--- .../yard/handlers/puppet/function_handler_spec.rb | 8 ++++---- .../yard/handlers/ruby/data_type_handler_spec.rb | 2 +- .../yard/handlers/ruby/function_handler_spec.rb | 2 +- .../yard/handlers/ruby/provider_handler_spec.rb | 2 +- .../yard/handlers/ruby/rsapi_handler_spec.rb | 2 +- .../yard/handlers/ruby/type_handler_spec.rb | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb index 8a50ef65c..24f88be68 100644 --- a/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/puppet/class_handler_spec.rb @@ -124,7 +124,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar { SOURCE it 'respects the type that was documented' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) tags = spec_subject.first.tags(:param) expect(tags.size).to eq(3) @@ -168,7 +168,7 @@ class foo(Integer $param1, $param2, String $param3 = hi) inherits foo::bar { SOURCE it 'respects the type that was documented' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) tags = spec_subject.first.tags(:param) expect(tags.size).to eq(3) @@ -189,7 +189,7 @@ class foo() { SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb index b83e8d16b..6b188aea5 100644 --- a/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/puppet/data_type_alias_handler_spec.rb @@ -43,7 +43,7 @@ SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb index 82f0c13eb..6f1df0560 100644 --- a/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/puppet/defined_type_handler_spec.rb @@ -132,7 +132,7 @@ SOURCE it 'respects the type that was documented' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) tags = spec_subject.first.tags(:param) expect(tags.size).to eq(3) @@ -174,7 +174,7 @@ SOURCE it 'respects the type that was documented' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) tags = spec_subject.first.tags(:param) expect(tags.size).to eq(3) @@ -198,7 +198,7 @@ SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb index 1297993ba..a0dde5c2b 100644 --- a/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/puppet/function_handler_spec.rb @@ -129,7 +129,7 @@ SOURCE it 'respects the type that was documented' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) tags = spec_subject.first.tags(:param) expect(tags.size).to eq(3) @@ -171,7 +171,7 @@ SOURCE it 'respects the type that was documented' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) tags = spec_subject.first.tags(:param) expect(tags.size).to eq(3) @@ -262,7 +262,7 @@ SOURCE it 'gets the return type from the function definition' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) object = spec_subject.first expect(object).to be_a(PuppetStrings::Yard::CodeObjects::Function) @@ -307,7 +307,7 @@ SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb index 6462511f6..474eca3c3 100644 --- a/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb @@ -569,7 +569,7 @@ def suppress_yard_logging SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb index f08659c05..0412627b6 100644 --- a/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/ruby/function_handler_spec.rb @@ -734,7 +734,7 @@ def other(b) SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb index 01470dd97..1078db7ae 100644 --- a/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/ruby/provider_handler_spec.rb @@ -130,7 +130,7 @@ SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb index 3a14fa4d8..2d59a8bc9 100644 --- a/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/ruby/rsapi_handler_spec.rb @@ -187,7 +187,7 @@ SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') diff --git a/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb index 8e226a0cd..c56f4428a 100644 --- a/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/ruby/type_handler_spec.rb @@ -298,7 +298,7 @@ SOURCE it 'parses the summary' do - expect { spec_subject }.to output('').to_stdout_from_any_process + expect { spec_subject }.not_to output.to_stdout_from_any_process expect(spec_subject.size).to eq(1) summary = spec_subject.first.tags(:summary) expect(summary.first.text).to eq('A short summary.') From 5eeaa06679ae8fd5db599d06fe7c9bf76d2e6ea2 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Wed, 1 May 2024 13:48:03 +0100 Subject: [PATCH 32/46] (CAT-1618) - Update ci trigger to pr target --- .github/workflows/ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 576a75fec..530ee481f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,10 @@ on: push: branches: - "main" - pull_request: - branches: - - "main" + pull_request_target: + types: + - opened + - synchronize workflow_dispatch: env: From 3f97165118c0955e41ef4f4075f5bbb6c6cd25ad Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Wed, 22 May 2024 10:06:42 +0100 Subject: [PATCH 33/46] (ITHELP-87329) - Update ci trigger to on PR --- .github/workflows/ci.yml | 7 +++---- .github/workflows/mend.yml | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 530ee481f..576a75fec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,10 +4,9 @@ on: push: branches: - "main" - pull_request_target: - types: - - opened - - synchronize + pull_request: + branches: + - "main" workflow_dispatch: env: diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml index 2ee195997..095e9e591 100644 --- a/.github/workflows/mend.yml +++ b/.github/workflows/mend.yml @@ -1,10 +1,9 @@ name: "mend" on: - pull_request_target: - types: - - opened - - synchronize + pull_request: + branches: + - "main" schedule: - cron: "0 0 * * *" workflow_dispatch: From ff919652f748a593f8dfd0d2116625f9087c94da Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Mon, 10 Jun 2024 11:59:59 +0100 Subject: [PATCH 34/46] (maint) Exclude breaking versions of rubocop-factory_bot, rubocop-rspect_rails Signed-off-by: Gavin Didrichsen --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index ecc46ab2b..6312f4daa 100644 --- a/Gemfile +++ b/Gemfile @@ -39,6 +39,8 @@ group :development do gem 'rubocop', '~> 1.50.0', require: false gem 'rubocop-performance', '~> 1.16', require: false gem 'rubocop-rspec', '~> 2.19', require: false + gem 'rubocop-factory_bot', '!= 2.26.0', require: false + gem 'rubocop-rspec_rails', '!= 2.29.0', require: false gem 'serverspec' gem 'simplecov', require: false From 09d393e4a0ed87fbeb400f9e51cb3f574f4bbb58 Mon Sep 17 00:00:00 2001 From: david22swan Date: Tue, 11 Jun 2024 16:05:15 +0100 Subject: [PATCH 35/46] (maint) Change from `pull_request_target` to `pull_request` --- .github/workflows/labeller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml index ee149bf52..0d4870d70 100644 --- a/.github/workflows/labeller.yml +++ b/.github/workflows/labeller.yml @@ -6,7 +6,7 @@ on: - opened - labeled - unlabeled - pull_request_target: + pull_request: types: - opened - labeled From c65c45c18140d4694c5bec7751391ff828625198 Mon Sep 17 00:00:00 2001 From: david22swan Date: Wed, 12 Jun 2024 12:37:40 +0100 Subject: [PATCH 36/46] Revert "(maint) Change from `pull_request_target` to `pull_request`" --- .github/workflows/labeller.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml index 0d4870d70..ee149bf52 100644 --- a/.github/workflows/labeller.yml +++ b/.github/workflows/labeller.yml @@ -6,7 +6,7 @@ on: - opened - labeled - unlabeled - pull_request: + pull_request_target: types: - opened - labeled From f330f4a65b15de7fa8ad57be93c8b47b124a63ea Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 13 Jun 2024 13:22:54 +0100 Subject: [PATCH 37/46] Revert "(maint) Exclude breaking rubocop versions" --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index 6312f4daa..ecc46ab2b 100644 --- a/Gemfile +++ b/Gemfile @@ -39,8 +39,6 @@ group :development do gem 'rubocop', '~> 1.50.0', require: false gem 'rubocop-performance', '~> 1.16', require: false gem 'rubocop-rspec', '~> 2.19', require: false - gem 'rubocop-factory_bot', '!= 2.26.0', require: false - gem 'rubocop-rspec_rails', '!= 2.29.0', require: false gem 'serverspec' gem 'simplecov', require: false From 542aff8e95b7e787e3e29d23a90bcb3e8621f516 Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 13 Jun 2024 13:23:44 +0100 Subject: [PATCH 38/46] Update rubocop gems --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index ecc46ab2b..5755615e2 100644 --- a/Gemfile +++ b/Gemfile @@ -36,9 +36,9 @@ group :development do gem 'rspec', '~> 3.1' gem 'rspec-its', '~> 1.0' - gem 'rubocop', '~> 1.50.0', require: false + gem 'rubocop', '~> 1.64.0', require: false gem 'rubocop-performance', '~> 1.16', require: false - gem 'rubocop-rspec', '~> 2.19', require: false + gem 'rubocop-rspec', '~> 3.0', require: false gem 'serverspec' gem 'simplecov', require: false From 90356a8050ed1a9253258c881cc5df2e41a8fb72 Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 20 Jun 2024 12:21:46 +0100 Subject: [PATCH 39/46] Remove deprecated Rspec/FilePath Signed-off-by: Gavin Didrichsen --- .rubocop.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index d0577de14..3e3740208 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -20,11 +20,3 @@ Style/ClassAndModuleChildren: Layout/LineLength: Max: 200 - -#################################################### -# Cops below here due for deprecation -#################################################### -# ``Rspec/FilePath`` is going to be deprecated in the next major release of rubocop >=3.0.0: see -# As the new cops are already present, e.g., Rspec/SpecFilePathPathFormat, then disabling this in preparation -RSpec/FilePath: - Enabled: false From ca1498e26a225d85fbb9b9e5d8157825aec8e9ce Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Thu, 20 Jun 2024 12:22:00 +0100 Subject: [PATCH 40/46] Fix rubocop warnings Signed-off-by: Gavin Didrichsen --- lib/puppet-strings/yard/code_objects/task.rb | 12 +++++------- .../yard/handlers/ruby/provider_handler.rb | 5 ++--- lib/puppet-strings/yard/parsers/puppet/statement.rb | 12 ++++++------ lib/puppet-strings/yard/tags/overload_tag.rb | 2 +- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/puppet-strings/yard/code_objects/task.rb b/lib/puppet-strings/yard/code_objects/task.rb index a94ff8d6b..e1f8cb320 100644 --- a/lib/puppet-strings/yard/code_objects/task.rb +++ b/lib/puppet-strings/yard/code_objects/task.rb @@ -44,14 +44,12 @@ def source end def parameters - parameters = [] - statement.parameters.each do |name, props| - parameters.push({ name: name.to_s, - tag_name: 'param', - text: props['description'] || '', - types: [props['type']] || '' }) + statement.parameters.map do |name, props| + { name: name.to_s, + tag_name: 'param', + text: props['description'] || '', + types: [props['type']] || '' } end - parameters end # Converts the code object to a hash representation. diff --git a/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb b/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb index 8f16f9919..9ce6213a7 100644 --- a/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb +++ b/lib/puppet-strings/yard/handlers/ruby/provider_handler.rb @@ -107,9 +107,8 @@ def populate_provider_data(object) parameters.each do |kvps| next unless kvps.count >= 1 - defaultfor = [] - kvps.each do |kvp| - defaultfor << [node_as_string(kvp[0]) || kvp[0].source, node_as_string(kvp[1]) || kvp[1].source] + defaultfor = kvps.map do |kvp| + [node_as_string(kvp[0]) || kvp[0].source, node_as_string(kvp[1]) || kvp[1].source] end object.add_default(defaultfor) end diff --git a/lib/puppet-strings/yard/parsers/puppet/statement.rb b/lib/puppet-strings/yard/parsers/puppet/statement.rb index 07102494d..f61568e85 100644 --- a/lib/puppet-strings/yard/parsers/puppet/statement.rb +++ b/lib/puppet-strings/yard/parsers/puppet/statement.rb @@ -92,7 +92,7 @@ def initialize(parameter) # @param object The Puppet parser model object that has parameters. # @param [String] file The file containing the statement. def initialize(object, file) - super(object, file) + super @parameters = object.parameters.map { |parameter| Parameter.new(parameter) } end end @@ -105,7 +105,7 @@ class ClassStatement < ParameterizedStatement # @param [Puppet::Pops::Model::HostClassDefinition] object The model object for the class statement. # @param [String] file The file containing the statement. def initialize(object, file) - super(object, file) + super @name = object.name @parent_class = object.parent_class end @@ -119,7 +119,7 @@ class DefinedTypeStatement < ParameterizedStatement # @param [Puppet::Pops::Model::ResourceTypeDefinition] object The model object for the defined type statement. # @param [String] file The file containing the statement. def initialize(object, file) - super(object, file) + super @name = object.name end end @@ -132,7 +132,7 @@ class FunctionStatement < ParameterizedStatement # @param [Puppet::Pops::Model::FunctionDefinition] object The model object for the function statement. # @param [String] file The file containing the statement. def initialize(object, file) - super(object, file) + super @name = object.name return unless object.respond_to? :return_type @@ -151,7 +151,7 @@ class PlanStatement < ParameterizedStatement # @param [Puppet::Pops::Model::PlanDefinition] object The model object for the plan statement. # @param [String] file The file containing the statement. def initialize(object, file) - super(object, file) + super @name = object.name end end @@ -164,7 +164,7 @@ class DataTypeAliasStatement < Statement # @param [Puppet::Pops::Model::TypeAlias] object The model object for the type statement. # @param [String] file The file containing the statement. def initialize(object, file) - super(object, file) + super type_expr = object.type_expr case type_expr diff --git a/lib/puppet-strings/yard/tags/overload_tag.rb b/lib/puppet-strings/yard/tags/overload_tag.rb index 8ae294250..04d0431fb 100644 --- a/lib/puppet-strings/yard/tags/overload_tag.rb +++ b/lib/puppet-strings/yard/tags/overload_tag.rb @@ -65,7 +65,7 @@ def has_tag?(name) # rubocop:disable Naming/PredicateName # @param [Object] value The object to associate with this tag. # @return [void] def object=(value) - super(value) + super @docstring.object = value @docstring.tags.each { |tag| tag.object = value } end From afdad0e1300ffd69393e93ef0b7bd608abb7589c Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Tue, 25 Jun 2024 18:54:37 +0100 Subject: [PATCH 41/46] Create jekyll-gh-pages.yml As a devx developer I want to publish GH Pages for several repositories. The [gh pages documentation](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages) is detailed. The following key points contributed to my decision to add this change: * Currently there a 2 ways to generate GH Pages on a repository. The documentation calls these "sources". One is a manual push; the other uses a special github action deployment workflow. * After June 2024, only the github action source will be used. * Best practice around documentation is that (1) a special github "environment" should be created called "github-pages" and (2) a unique branch "gh-pages" should be created alongside the "main". The environment is a set of rules that limits documentation deployments from specific branches and the unique branch means that "code" and site-documentation are kept separate. Therefore, I created the github-pages environment, the gh-pages branch, and the github action workflow defined in this PR --- .github/workflows/jekyll-gh-pages.yml | 51 +++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/jekyll-gh-pages.yml diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml new file mode 100644 index 000000000..e31d81c58 --- /dev/null +++ b/.github/workflows/jekyll-gh-pages.yml @@ -0,0 +1,51 @@ +# Sample workflow for building and deploying a Jekyll site to GitHub Pages +name: Deploy Jekyll with GitHub Pages dependencies preinstalled + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./ + destination: ./_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 3bdddbee70b1765295880eed40be71d34a2cb8f4 Mon Sep 17 00:00:00 2001 From: Gavin Didrichsen Date: Wed, 26 Jun 2024 16:24:00 +0100 Subject: [PATCH 42/46] Update jekyll-gh-pages.yml --- .github/workflows/jekyll-gh-pages.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index e31d81c58..14b691c66 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -1,5 +1,4 @@ -# Sample workflow for building and deploying a Jekyll site to GitHub Pages -name: Deploy Jekyll with GitHub Pages dependencies preinstalled +name: Deploy GitHub Pages on: # Runs on pushes targeting the default branch From 30c64dd34f7678388dc2b0cdb3b4eb05be56b0cd Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 10 Jul 2024 13:43:50 +0100 Subject: [PATCH 43/46] (CAT-1954) Remove labeller --- .github/workflows/labeller.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/labeller.yml diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml deleted file mode 100644 index ee149bf52..000000000 --- a/.github/workflows/labeller.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Labeller - -on: - issues: - types: - - opened - - labeled - - unlabeled - pull_request_target: - types: - - opened - - labeled - - unlabeled - -jobs: - label: - runs-on: ubuntu-latest - steps: - - - uses: puppetlabs/community-labeller@v1.0.1 - name: Label issues or pull requests - with: - label_name: community - label_color: '5319e7' - org_membership: puppetlabs - fail_if_member: 'true' - token: ${{ secrets.IAC_COMMUNITY_LABELER }} From 88169c76db9b9428b960129d5a3b73eea24e1e68 Mon Sep 17 00:00:00 2001 From: jordanbreen28 Date: Thu, 5 Sep 2024 15:37:41 +0100 Subject: [PATCH 44/46] (bug) - Pin yard to < 0.9.37 Yard 0.9.37 was released, which broke our pipeline and also broke some module CI. This commit adds a temporary pin to the gem to < 0.9.37, until we can resolve these issues. --- puppet-strings.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/puppet-strings.gemspec b/puppet-strings.gemspec index 6a8d216f5..13240f753 100644 --- a/puppet-strings.gemspec +++ b/puppet-strings.gemspec @@ -23,6 +23,6 @@ Gem::Specification.new do |s| s.files = Dir['CHANGELOG.md', 'README.md', 'LICENSE', 'lib/**/*', 'exe/**/*'] s.add_runtime_dependency 'rgen', '~> 0.9' - s.add_runtime_dependency 'yard', '~> 0.9' + s.add_runtime_dependency 'yard', '~> 0.9', '< 0.9.37' s.requirements << 'puppet, >= 7.0.0' end From 7c51b1005d47d58ea4c9e6dba321e3191d4cbb6e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 5 Sep 2024 15:08:26 +0000 Subject: [PATCH 45/46] Release prep v4.1.3 --- CHANGELOG.md | 15 +++++++++++++++ lib/puppet-strings/version.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1fea3eec..19775730d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## [v4.1.3](https://github.com/puppetlabs/puppet-strings/tree/v4.1.3) - 2024-09-05 + +[Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.2...v4.1.3) + +### Fixed + +- (bug) - Pin yard to < 0.9.37 [#401](https://github.com/puppetlabs/puppet-strings/pull/401) ([jordanbreen28](https://github.com/jordanbreen28)) +- validate: give hint on how to regenerate outdated REFERENCE.md [#388](https://github.com/puppetlabs/puppet-strings/pull/388) ([kenyon](https://github.com/kenyon)) +- (CAT-1688) Upgrade rubocop to `~> 1.50.0` [#383](https://github.com/puppetlabs/puppet-strings/pull/383) ([LukasAud](https://github.com/LukasAud)) +- Allow numerics for templates using code_maybe_block [#382](https://github.com/puppetlabs/puppet-strings/pull/382) ([seanmil](https://github.com/seanmil)) + ## [v4.1.2](https://github.com/puppetlabs/puppet-strings/tree/v4.1.2) - 2023-12-05 [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v4.1.1...v4.1.2) @@ -38,6 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v3.0.1...v4.0.0.rc.1) ### Changed + - (CONT-812) Puppet 8 / Ruby 3 support [#348](https://github.com/puppetlabs/puppet-strings/pull/348) ([chelnak](https://github.com/chelnak)) ### Added @@ -57,6 +69,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.9.0...v3.0.0) ### Changed + - (CONT-228) Remove deprecated emit flags [#329](https://github.com/puppetlabs/puppet-strings/pull/329) ([chelnak](https://github.com/chelnak)) - (CONT-228) Bump ruby version [#326](https://github.com/puppetlabs/puppet-strings/pull/326) ([chelnak](https://github.com/chelnak)) - (#301) Update minimum Ruby version to 2.5.0 [#313](https://github.com/puppetlabs/puppet-strings/pull/313) ([danielparks](https://github.com/danielparks)) @@ -113,6 +126,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/v2.5.0...v2.6.0) ### Changed + - (MAINT) Drop Ruby 2.1.x and Puppet 4.x compatibility [#253](https://github.com/puppetlabs/puppet-strings/pull/253) ([scotje](https://github.com/scotje)) ### Added @@ -206,6 +220,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppet-strings/compare/1.2.1...2.0.0) ### Changed + - bump required ruby and puppet versions [#178](https://github.com/puppetlabs/puppet-strings/pull/178) ([eputnam](https://github.com/eputnam)) ### Added diff --git a/lib/puppet-strings/version.rb b/lib/puppet-strings/version.rb index 619b4b942..6f12c1305 100644 --- a/lib/puppet-strings/version.rb +++ b/lib/puppet-strings/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module PuppetStrings - VERSION = '4.1.2' + VERSION = '4.1.3' end From 0eeb75d168422ce3599220148e92952d8b0e3286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 30 Oct 2024 16:34:59 -1000 Subject: [PATCH 46/46] Fix CI with latest yard Monkey patching libraries is a bad idea. Latest version of yard changed some internal details, which broke CI. A workaround was proposed in #401 but the root cause was not addressed. In this commit, we replace the private `io` object with an instance of a class that provide the expected `IO#write` method instead of `nil` which does not provide this interface in CI, so that the issue is not raised anymore. --- puppet-strings.gemspec | 2 +- .../yard/handlers/ruby/data_type_handler_spec.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/puppet-strings.gemspec b/puppet-strings.gemspec index 13240f753..6a8d216f5 100644 --- a/puppet-strings.gemspec +++ b/puppet-strings.gemspec @@ -23,6 +23,6 @@ Gem::Specification.new do |s| s.files = Dir['CHANGELOG.md', 'README.md', 'LICENSE', 'lib/**/*', 'exe/**/*'] s.add_runtime_dependency 'rgen', '~> 0.9' - s.add_runtime_dependency 'yard', '~> 0.9', '< 0.9.37' + s.add_runtime_dependency 'yard', '~> 0.9' s.requirements << 'puppet, >= 7.0.0' end diff --git a/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb b/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb index 474eca3c3..8ffb08b91 100644 --- a/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb +++ b/spec/unit/puppet-strings/yard/handlers/ruby/data_type_handler_spec.rb @@ -3,6 +3,10 @@ require 'spec_helper' require 'puppet-strings/yard' +class NullLogger + def write(_message); end +end + describe PuppetStrings::Yard::Handlers::Ruby::DataTypeHandler, if: TEST_PUPPET_DATATYPES do subject(:spec_subject) do YARD::Parser::SourceParser.parse_string(source, :ruby) @@ -19,7 +23,7 @@ end def suppress_yard_logging - YARD::Logger.instance.io = nil + YARD::Logger.instance.io = NullLogger.new end describe 'parsing source without a data type definition' do