Skip to content

feat: Add flagsmith-lint-tests and fix all violations#178

Merged
khvn26 merged 3 commits intomainfrom
feat/lint-tests-ft-rules
Mar 12, 2026
Merged

feat: Add flagsmith-lint-tests and fix all violations#178
khvn26 merged 3 commits intomainfrom
feat/lint-tests-ft-rules

Conversation

@khvn26
Copy link
Member

@khvn26 khvn26 commented Mar 12, 2026

  • Add a custom linter (flagsmith-lint-tests) enforcing test conventions: function-only tests (FT001), no unittest imports (FT002), test_{subject}__{condition}__{expected} naming (FT003), and Given/When/Then comments (FT004)
  • Install the linter as a pre-commit hook
  • Fix all existing FT003/FT004 violations across the test suite (19 files, ~80 suppressions removed)

Usage

To use the hook from another repo, add to .pre-commit-config.yaml:

- repo: https://github.com/Flagsmith/flagsmith-common
  rev: <tag-or-commit-sha>
  hooks:
    - id: flagsmith-lint-tests

Test plan

  • python -m common.lint_tests passes on all test files
  • All pre-commit hooks pass
  • CI passes

@khvn26 khvn26 requested a review from a team as a code owner March 12, 2026 12:24
@khvn26 khvn26 requested review from Zaimwa9 and removed request for a team March 12, 2026 12:24
@khvn26 khvn26 changed the title feat: add FT lint rules and fix all violations feat: Add flagsmith-lint-tests and fix all violations Mar 12, 2026
@khvn26 khvn26 force-pushed the feat/lint-tests-ft-rules branch from a150650 to 1292a65 Compare March 12, 2026 12:32
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.11%. Comparing base (8535029) to head (9407e0f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #178      +/-   ##
==========================================
+ Coverage   95.90%   96.11%   +0.21%     
==========================================
  Files          90       92       +2     
  Lines        3051     3220     +169     
==========================================
+ Hits         2926     3095     +169     
  Misses        125      125              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@khvn26 khvn26 force-pushed the feat/lint-tests-ft-rules branch 2 times, most recently from b99d2c7 to 87ee37d Compare March 12, 2026 13:21
Add a custom linter (flagsmith-lint-tests) enforcing Flagsmith test
conventions: function-only tests (FT001), no unittest imports (FT002),
test_{subject}__{condition}__{expected} naming (FT003), and
Given/When/Then comments (FT004).
@khvn26 khvn26 force-pushed the feat/lint-tests-ft-rules branch from 87ee37d to b53f593 Compare March 12, 2026 13:50
Install the flagsmith-lint-tests hook in pre-commit config and fix all
existing FT003/FT004 violations across the test suite by renaming tests
to test_{subject}__{condition}__{expected} and adding Given/When/Then
comments.
emyller
emyller previously approved these changes Mar 12, 2026
Copy link
Contributor

@emyller emyller left a comment

Choose a reason for hiding this comment

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

Yes!

@khvn26 khvn26 force-pushed the feat/lint-tests-ft-rules branch from ce0d817 to 9407e0f Compare March 12, 2026 15:19
Copy link
Contributor

@emyller emyller left a comment

Choose a reason for hiding this comment

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

I was about to comment on the rev line... LGTM!

@khvn26 khvn26 merged commit d043589 into main Mar 12, 2026
4 checks passed
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.

3 participants