Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
# using RuboCop version 1.81.7.
# using RuboCop version 1.85.1.
# 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
Expand All @@ -10,18 +10,18 @@
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
Lint/DuplicateBranch:
Exclude:
- 'lib/puppet-syntax/templates.rb'
- 'lib/puppetlabs-syntax/templates.rb'

# Offense count: 1
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Exclude:
- 'lib/puppet-syntax/tasks/puppet-syntax.rb'
- 'lib/puppetlabs-syntax/tasks/puppetlabs-syntax.rb'

# Offense count: 1
Lint/RescueException:
Exclude:
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppetlabs-syntax/hiera.rb'

# Offense count: 1
# Configuration parameters: AllowComments, AllowNil.
Expand All @@ -36,17 +36,17 @@ Lint/SuppressedException:
Naming/FileName:
Exclude:
- 'Rakefile.rb'
- 'lib/puppet-syntax.rb'
- 'lib/puppet-syntax/tasks/puppet-syntax.rb'
- 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
- 'spec/puppet-syntax_spec.rb'
- 'lib/puppetlabs-syntax.rb'
- 'lib/puppetlabs-syntax/tasks/puppetlabs-syntax.rb'
- 'spec/puppetlabs-syntax/tasks/puppetlabs-syntax_spec.rb'
- 'spec/puppetlabs-syntax_spec.rb'

# Offense count: 1
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppetlabs-syntax/hiera_spec.rb'

# Offense count: 1
# Configuration parameters: IgnoredMetadata.
Expand All @@ -57,7 +57,7 @@ RSpec/DescribeClass:
- '**/spec/routing/**/*'
- '**/spec/system/**/*'
- '**/spec/views/**/*'
- 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
- 'spec/puppetlabs-syntax/tasks/puppetlabs-syntax_spec.rb'

# Offense count: 8
# Configuration parameters: CountAsOne.
Expand All @@ -67,111 +67,111 @@ RSpec/ExampleLength:
# Offense count: 6
RSpec/LeakyLocalVariable:
Exclude:
- 'spec/puppet-syntax/tasks/puppet-syntax_spec.rb'
- 'spec/puppetlabs-syntax/tasks/puppetlabs-syntax_spec.rb'

# Offense count: 32
# Offense count: 33
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/manifests_spec.rb'
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppetlabs-syntax/hiera_spec.rb'
- 'spec/puppetlabs-syntax/manifests_spec.rb'
- 'spec/puppetlabs-syntax/templates_spec.rb'

# Offense count: 8
RSpec/RepeatedDescription:
Exclude:
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppetlabs-syntax/templates_spec.rb'

# Offense count: 4
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
# SupportedInflectors: default, active_support
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/manifests_spec.rb'
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppet-syntax_spec.rb'
- 'spec/puppetlabs-syntax/hiera_spec.rb'
- 'spec/puppetlabs-syntax/manifests_spec.rb'
- 'spec/puppetlabs-syntax/templates_spec.rb'
- 'spec/puppetlabs-syntax_spec.rb'

# Offense count: 3
RSpec/SubjectDeclaration:
Exclude:
- 'spec/puppet-syntax/hiera_spec.rb'
- 'spec/puppet-syntax/manifests_spec.rb'
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppetlabs-syntax/hiera_spec.rb'
- 'spec/puppetlabs-syntax/manifests_spec.rb'
- 'spec/puppetlabs-syntax/templates_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, conditionals
Style/AndOr:
Exclude:
- 'lib/puppet-syntax/templates.rb'
- 'lib/puppetlabs-syntax/templates.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: MinBranchesCount.
Style/CaseLikeIf:
Exclude:
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppetlabs-syntax/hiera.rb'

# Offense count: 5
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/puppet-syntax.rb'
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppet-syntax/tasks/puppet-syntax.rb'
- 'lib/puppet-syntax/templates.rb'
- 'lib/puppetlabs-syntax.rb'
- 'lib/puppetlabs-syntax/hiera.rb'
- 'lib/puppetlabs-syntax/manifests.rb'
- 'lib/puppetlabs-syntax/tasks/puppetlabs-syntax.rb'
- 'lib/puppetlabs-syntax/templates.rb'

# Offense count: 1
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppetlabs-syntax/hiera.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'spec/puppet-syntax/templates_spec.rb'
- 'spec/puppetlabs-syntax/templates_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SelectByRegexp:
Exclude:
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppetlabs-syntax/manifests.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: RequireEnglish, EnforcedStyle.
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
Style/SpecialGlobalVars:
Exclude:
- 'puppet-syntax.gemspec'
- 'puppetlabs-syntax.gemspec'

# Offense count: 4
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
# AllowedMethods: define_method
Style/SymbolProc:
Exclude:
- 'lib/puppet-syntax/hiera.rb'
- 'lib/puppet-syntax/manifests.rb'
- 'lib/puppet-syntax/templates.rb'
- 'lib/puppetlabs-syntax/hiera.rb'
- 'lib/puppetlabs-syntax/manifests.rb'
- 'lib/puppetlabs-syntax/templates.rb'

# Offense count: 5
# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 211
58 changes: 30 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
# puppet-syntax
# puppetlabs-syntax

[![License](https://img.shields.io/github/license/voxpupuli/puppet-syntax.svg)](https://github.com/voxpupuli/puppet-syntax/blob/master/LICENSE.txt)
[![Release](https://github.com/voxpupuli/puppet-syntax/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-syntax/actions/workflows/release.yml)
[![Test](https://github.com/voxpupuli/puppet-syntax/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/puppet-syntax/actions/workflows/test.yml)
[![RubyGem Version](https://img.shields.io/gem/v/puppet-syntax.svg)](https://rubygems.org/gems/puppet-syntax)
[![RubyGem Downloads](https://img.shields.io/gem/dt/puppet-syntax.svg)](https://rubygems.org/gems/puppet-syntax)
> This is the Perforce-maintained puppetlabs fork of [voxpupuli/puppet-syntax](https://github.com/voxpupuli/puppet-syntax). It exists to unblock puppet ↔ openvox core switching in downstream apps. Not a drop-in replacement for the upstream gem.

# Puppet::Syntax
[![License](https://img.shields.io/github/license/puppetlabs/puppetlabs-syntax.svg)](https://github.com/puppetlabs/puppetlabs-syntax/blob/master/LICENSE.txt)
[![Release](https://github.com/puppetlabs/puppetlabs-syntax/actions/workflows/release.yml/badge.svg)](https://github.com/puppetlabs/puppetlabs-syntax/actions/workflows/release.yml)
[![Test](https://github.com/puppetlabs/puppetlabs-syntax/actions/workflows/ci.yml/badge.svg)](https://github.com/puppetlabs/puppetlabs-syntax/actions/workflows/ci.yml)
[![RubyGem Version](https://img.shields.io/gem/v/puppetlabs-syntax.svg)](https://rubygems.org/gems/puppetlabs-syntax)
[![RubyGem Downloads](https://img.shields.io/gem/dt/puppetlabs-syntax.svg)](https://rubygems.org/gems/puppetlabs-syntax)

Puppet::Syntax checks for correct syntax in Puppet manifests, templates, and
# Puppetlabs::Syntax

Puppetlabs::Syntax checks for correct syntax in Puppet manifests, templates, and
Hiera YAML.

## Version support

Puppet::Syntax is supported with:
Puppetlabs::Syntax is supported with:

- OpenVox >= 8.0
- Puppet >= 8.0, < 10
- Ruby >= 3.2

For the specific versions that we test against, see the [GitHub Actions workflow](.github/workflows/test.yml) or the [Gem spec](puppet-syntax.gemspec).
For the specific versions that we test against, see the [GitHub Actions workflow](.github/workflows/ci.yml) or the [Gem spec](puppetlabs-syntax.gemspec).

## Installation

To install Puppet::Syntax, either add it to your module's Gemfile or install
To install Puppetlabs::Syntax, either add it to your module's Gemfile or install
the gem manually.

* To install with the Gemfile, add:

```ruby
gem 'puppet-syntax'
gem 'puppetlabs-syntax'
```

And then execute:
Expand All @@ -40,42 +42,42 @@ bundle install
* To install the gem yourself, run:

```sh
gem install puppet-syntax
gem install puppetlabs-syntax
```

## Configuration

To configure Puppet::Syntax, add any of the following settings to your `Rakefile`.
To configure Puppetlabs::Syntax, add any of the following settings to your `Rakefile`.

* To exclude certain paths from the syntax checks, set:

```ruby
PuppetSyntax.exclude_paths = ["vendor/**/*"]
PuppetlabsSyntax.exclude_paths = ["vendor/**/*"]
```

* To configure specific paths for the Hiera syntax check, specify `hieradata_paths`. This is useful if you use Hiera data inside your module.

```ruby
PuppetSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"]
PuppetlabsSyntax.hieradata_paths = ["**/data/**/*.yaml", "hieradata/**/*.yaml", "hiera*.yaml"]
```

* To configure specific paths for the Puppet syntax checks or for the templates checks, specify `manifests_paths` or `templates_paths` respectively. This is useful if you want to check specific paths only.

```ruby
PuppetSyntax.manifests_paths = ["**/environments/future/*.pp"]
PuppetSyntax.templates_paths = ["**/modules/**/templates/*.erb"]
PuppetlabsSyntax.manifests_paths = ["**/environments/future/*.pp"]
PuppetlabsSyntax.templates_paths = ["**/modules/**/templates/*.erb"]
```

* To ignore deprecation warnings, disable `fail_on_deprecation_notices`. By default, `puppet-syntax` fails if it encounters Puppet deprecation notices. If you are working with a legacy code base and want to ignore such non-fatal warnings, you might want to override the default behavior.
* To ignore deprecation warnings, disable `fail_on_deprecation_notices`. By default, `puppetlabs-syntax` fails if it encounters Puppet deprecation notices. If you are working with a legacy code base and want to ignore such non-fatal warnings, you might want to override the default behavior.

```ruby
PuppetSyntax.fail_on_deprecation_notices = false
PuppetlabsSyntax.fail_on_deprecation_notices = false
```

* To enable a syntax check on Hiera keys, set:

```ruby
PuppetSyntax.check_hiera_keys = true
PuppetlabsSyntax.check_hiera_keys = true
```

This reports common mistakes in key names in Hiera files, such as:
Expand All @@ -89,18 +91,18 @@ This reports common mistakes in key names in Hiera files, such as:
* To enable a syntax check on Hiera values, set:

```ruby
PuppetSyntax.check_hiera_data = true
PuppetlabsSyntax.check_hiera_data = true
```

## Usage

* To enable Puppet::Syntax, include the following in your module's `Rakefile`:
* To enable Puppetlabs::Syntax, include the following in your module's `Rakefile`:

```ruby
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppetlabs-syntax/tasks/puppetlabs-syntax'
```

For Continuous Integration, use Puppet::Syntax in conjunction with `puppet-lint`
For Continuous Integration, use Puppetlabs::Syntax in conjunction with `puppet-lint`
and spec tests. Add the following to your module's `Rakefile`:

```ruby
Expand Down Expand Up @@ -133,7 +135,7 @@ Tasks: TOP => syntax => syntax:manifests

## Checks

Puppet::Syntax makes the following checks in the directories and subdirectories
Puppetlabs::Syntax makes the following checks in the directories and subdirectories
of the module, relative to the location of the `Rakefile`.

### Hiera
Expand Down Expand Up @@ -188,7 +190,7 @@ parser enabled.

## Making a new Release

* Update version in `lib/puppet-syntax/version.rb`
* Update version in `lib/puppetlabs-syntax/version.rb`
* Run the changelog rake task (bundle exec rake changelog)
* Create a PR
* Get it reviewed and merged
Expand Down
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ RSpec::Core::RakeTask.new('spec')
task default: [:spec]
begin
require 'github_changelog_generator/task'
require 'puppet-syntax/version'
require 'puppetlabs-syntax/version'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
version = PuppetSyntax::VERSION
version = PuppetlabsSyntax::VERSION
config.future_release = "v#{version}" if /^\d+\.\d+.\d+$/.match?(version)
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix modulesync skip-changelog github_actions]
config.user = 'voxpupuli'
config.project = 'puppet-syntax'
config.user = 'puppetlabs'
config.project = 'puppetlabs-syntax'
end
rescue LoadError
end
Expand Down
5 changes: 0 additions & 5 deletions lib/puppet-syntax/version.rb

This file was deleted.

10 changes: 5 additions & 5 deletions lib/puppet-syntax.rb → lib/puppetlabs-syntax.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

require 'puppet-syntax/version'
require 'puppetlabs-syntax/version'

module PuppetSyntax
autoload :Hiera, 'puppet-syntax/hiera'
autoload :Manifests, 'puppet-syntax/manifests'
autoload :Templates, 'puppet-syntax/templates'
module PuppetlabsSyntax
autoload :Hiera, 'puppetlabs-syntax/hiera'
autoload :Manifests, 'puppetlabs-syntax/manifests'
autoload :Templates, 'puppetlabs-syntax/templates'

@exclude_paths = [
'spec/fixtures/**/*',
Expand Down
Loading
Loading