Skip to content

feat(spdx_license): include tryParse#817

Merged
alestiago merged 2 commits intomainfrom
alestiago/spdx-license-try-parse
Oct 2, 2023
Merged

feat(spdx_license): include tryParse#817
alestiago merged 2 commits intomainfrom
alestiago/spdx-license-try-parse

Conversation

@alestiago
Copy link
Contributor

@alestiago alestiago commented Sep 29, 2023

Description

Adds a tryParse method to validate future CLI user inputs when white/black listing certain licenses. unknown will be a valid license type but erroneous input (for example, MIP instead of MIT) should throw an exception for a better user experience.

Changes:

  • Modified parse to throw a FormatException when failed to parse (similar to int.parse)
  • Included tryParse to return null if can't be parsed (similar to int.tryParse)

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@alestiago alestiago added the feature A new feature or request label Sep 29, 2023
@alestiago alestiago self-assigned this Sep 29, 2023
@alestiago alestiago merged commit 8ae689f into main Oct 2, 2023
@alestiago alestiago deleted the alestiago/spdx-license-try-parse branch October 2, 2023 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature or request

Projects

Development

Successfully merging this pull request may close these issues.

3 participants