Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove variable syntax regex character ranges #7431

Merged
merged 9 commits into from
Mar 7, 2020

Conversation

arbbakbenny
Copy link
Contributor

What did you implement

Closes #6559 and #6997. Expand regex for variable syntax by removing fixed character ranges thus allowing non ascii characters as valid fallback values.

How can we verify it

Checkout to dea5ecc2a0406bc46eb38f6cb8dfc17363d90498 and run lib/classes/Variables.test.js::fallback and lib/plugins/print/print.test.js::should resolve fallback tests. Both should fail. Checkout to HEAD, tests should pass.

Given a serverless.yml

service: variables

provider:
  name: aws
  runtime: nodejs12.x
  profile: dev
  region: eu-central-1
  stage: dev
  environment:
    HELLO: world+
    DEFAULT: ${env:unused, '++++++'}
    JAPANESE: ${env:unused, 'システム管理者'}

functions:
  hello:
    handler: handler.hello

With hello content:

'use strict';

module.exports.hello = async event => {
  return {
    statusCode: 200,
    body: {
        message: 'Go Serverless v1.0! Your function executed successfully!',
        hello: process.env.HELLO,
        plus: process.env.DEFAULT,
        jap: process.env.JAPANESE
    },
  };
};

When invoking it should return resolved values.

Todos

  • Write and run all tests
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: It should be backward compatible so no.

@codecov-io
Copy link

Codecov Report

Merging #7431 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7431   +/-   ##
=======================================
  Coverage   87.98%   87.98%           
=======================================
  Files         240      240           
  Lines        9064     9064           
=======================================
  Hits         7975     7975           
  Misses       1089     1089
Impacted Files Coverage Δ
lib/plugins/print/print.js 98.5% <ø> (ø) ⬆️
lib/classes/Service.js 97.43% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd7f8cb...8ba3001. Read the comment docs.

Copy link
Contributor

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @arbbakbenny Looks great!

@medikoo medikoo merged commit 7310782 into serverless:master Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable Defaults cannot have + in them
3 participants