Skip to content

Turn existing formatted strings into f-strings#3186

Merged
karlhigley merged 2 commits intoOpenMined:masterfrom
TTitcombe:add_fstring_linter
Mar 13, 2020
Merged

Turn existing formatted strings into f-strings#3186
karlhigley merged 2 commits intoOpenMined:masterfrom
TTitcombe:add_fstring_linter

Conversation

@TTitcombe
Copy link
Member

This PR:

  • Ran a linter, flynt, to turn formatted strings which already exist in the codebase to f-strings
  • Adds flynt to pre-commit

f-strings are quicker than other types of formatting strings.

I can remove the pre-commit addition if needed. It may not be worth the additional overhead of running pre-commit so long as non-f strings in new PRs are caught in review.

There is no existing issue relating to this PR.

To test:

  1. Check than the converted strings have been formatted correctly
  2. Check pre-commit compiles and works as expected

types: [python]
language: python
additional_dependencies:
- flynt
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be added to the dependencies files?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not for the pre-commit to work - it will install it automatically if needed - but perhaps it would simplify things to add flynt to dev dependencies anyway. Will do that in a bit

@karlhigley karlhigley added Type: Code Quality 💯 Minor tweaks or style changes Type: Refactor 🔨 A complete overhaul of a file, feature, or codebase Type: Testing 🧪 Add testing or improving existing testing of a file, feature, or codebase labels Mar 12, 2020
@karlhigley karlhigley merged commit 0561a5d into OpenMined:master Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Code Quality 💯 Minor tweaks or style changes Type: Refactor 🔨 A complete overhaul of a file, feature, or codebase Type: Testing 🧪 Add testing or improving existing testing of a file, feature, or codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants