GithubHelp home page GithubHelp logo

isabella232 / puppet-lint-i18n Goto Github PK

View Code? Open in Web Editor NEW

This project forked from puppetlabs/puppet-lint-i18n

0.0 0.0 0.0 29 KB

detect and decorate puppet code for internationalization

License: Apache License 2.0

Ruby 100.00%

puppet-lint-i18n's Introduction

puppet-lint-i18n plugin

Installation

To use this plugin, add the following like to the Gemfile in your Puppet code base and run bundle install.

gem 'puppet-lint-i18n'

Usage

This plugin provides a new check to puppet-lint. It will detect functions that do not have their output message wrapped in a translate call.

Functions detected

  • warning
  • fail

Before and after

For example the following puppet code does not wrap the message

warning('message')

wrapping the message then looks like

warning(translate('message'))

Example output

WARNING: 'warning' messages should be decorated: eg translate('old_root_password is no longer used and will be removed in a future release') on line 48

This tells you which file and what line the infringement occurred, as well as the suggested fix

Other Infringements

  • Multiline strings

BAD

warning(translate('to be or') / 
translate('not to be'))

GOOD

warning(translate('to be or not to be')
  • Concatenated strings
  • Heredoc strings

The :HEREDOC_OPEN token (@(EOL)) should be the only part passed to the translate() function. Do not pass the entire heredoc.

BAD

warning(translate(@(EOL)
  This is a heredoc.
  It's lovely. 
  | EOL))

GOOD

warning(translate(@(EOL))
  This is a heredoc.
  It's lovely. 
  | EOL)
  • Interpolated strings

Interpolated strings are not supported at this time and will not be decorated with the fix option.

Fix issues automatically

--fix support: Yes

Disabling checks

Please refer to the documentation here [https://github.com/rodjek/puppet-lint#disable-lint-checks]

puppet-lint-i18n's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.