Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Add validation with regex in the config.json inputs #512

Merged
merged 24 commits into from
Oct 5, 2020
Merged

Add validation with regex in the config.json inputs #512

merged 24 commits into from
Oct 5, 2020

Conversation

JoaoDanielRufino
Copy link
Contributor

@JoaoDanielRufino JoaoDanielRufino commented Sep 10, 2020

Signed-off-by: JoaoDanielRufino joaodaniel0405@gmail.com

- What I did
Added regex type to config.json to check if user input is in accordance with he specified regex in config.json, if not, it will print the mismatchText message and wait for a valid input

- How to verify it
Inside config.json include:

{
  "dockerImageBuilder": "cimg/base:stable-20.04",
  "inputs": [
    {
      "cache": {
        "active": true,
        "newLabel": "Type new value: ",
        "qty": 6
      },
      "label": "Cluster Name: ",
      "name": "cluster_name",
      "type": "text",
      "pattern": {
            "regex": "your_regex",
            "mismatchText": "your mismatch text"
      }
    }
  ]
}

- Description for the changelog
Regex type to config.json

Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
@joaorufinozup joaorufinozup added ✨ feature Suggest a new feature or enhancement to the Ritchie project 🚧 WIP Work in Progress labels Sep 10, 2020
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
@joaorufinozup joaorufinozup linked an issue Sep 10, 2020 that may be closed by this pull request
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2020

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #512   +/-   ##
=======================================
  Coverage   80.34%   80.34%           
=======================================
  Files          98       98           
  Lines        3287     3287           
=======================================
  Hits         2641     2641           
  Misses        462      462           
  Partials      184      184           

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 555ee9d...de11e8c. Read the comment docs.

@joaorufinozup joaorufinozup added ✔️ ready-for-review ready for review and removed 🚧 WIP Work in Progress labels Sep 10, 2020
@fabianofernandeszup fabianofernandeszup changed the title Regex type to config.json Add validation with regex in the config.json inputs Sep 10, 2020
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
@joaorufinozup joaorufinozup added ✔️ ready-for-review ready for review and removed 🕒 Wait labels Sep 22, 2020
Copy link
Contributor

@kaduartur kaduartur left a comment

Choose a reason for hiding this comment

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

Waiting for your changes. Good job!

if err != nil {
return err
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

could you remove else statement and add break?

Copy link

@joaorufinozup joaorufinozup Sep 24, 2020

Choose a reason for hiding this comment

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

I did not understand, because with the break, the for loop will end, is this the correct behavior that you want?

pkg/formula/runner/inputs.go Outdated Show resolved Hide resolved
pkg/formula/runner/inputs_test.go Show resolved Hide resolved
@kaduartur kaduartur added 🕒 Wait and removed ✔️ ready-for-review ready for review labels Sep 24, 2020
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
brunasilvazup
brunasilvazup previously approved these changes Sep 29, 2020
Copy link
Contributor

@brunasilvazup brunasilvazup left a comment

Choose a reason for hiding this comment

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

LGTM

@henriquemoraeszup henriquemoraeszup merged commit 48f1baa into ZupIT:master Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✔️ ready-for-review ready for review ✨ feature Suggest a new feature or enhancement to the Ritchie project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add validation with regex in the config.json inputs
7 participants