Skip to content

Fix/remove zero fractions#3224

Merged
arkid15r merged 2 commits intoOWASP:mainfrom
hussainjamal760:fix/remove-zero-fractions
Jan 6, 2026
Merged

Fix/remove zero fractions#3224
arkid15r merged 2 commits intoOWASP:mainfrom
hussainjamal760:fix/remove-zero-fractions

Conversation

@hussainjamal760
Copy link
Contributor

Resolves #3222

This PR addresses the issue reported in #3222.
All similar cases across the codebase have been fixed to ensure consistency and proper functionality.

Changes include:

Fixed the specific bug/issue mentioned in #3222.

Reviewed and corrected similar instances throughout the project(frontend).

Ensured that the code follows the existing coding standards and passes all validations.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Summary by CodeRabbit

  • Refactor
    • Updated numeric literal formatting in internal test data and component configurations for consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

The PR removes unnecessary .0 suffixes from numeric literals across test files and source code, converting floating-point literals (e.g., 1.0, 1000000.0) to their integer equivalents (1, 1000000). Functionality remains unchanged.

Changes

Cohort / File(s) Summary
Test files - Numeric literal cleanup
frontend/__tests__/unit/components/ChapterMap.test.tsx, frontend/__tests__/unit/components/DonutBarChart.test.tsx
Updated expected assertion values: maxBoundsViscosity from 1.0 to 1; chart series first two values from 1000000.0 to 1000000
Mock data files - Numeric literal cleanup
frontend/__tests__/unit/data/mockCommitteeDetailsData.ts, frontend/__tests__/unit/data/mockSnapshotData.ts
Changed updatedAt timestamps from floating-point (1734103212.0, 1727353371.0) to integer format (1734103212, 1727353371)
Component source - Numeric literal cleanup
frontend/src/components/ChapterMap.tsx
Updated map initialization option maxBoundsViscosity from 1.0 to 1

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested labels

frontend, frontend-tests

Suggested reviewers

  • arkid15r
  • kasya

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix/remove zero fractions' directly summarizes the main change: converting floating-point literals with zero fractional parts (like 1.0) to integers (like 1) across multiple files.
Description check ✅ Passed The description relates to the changeset by referencing issue #3222 and describing fixes applied across the frontend codebase, matching the actual changes of removing zero fractions from numeric literals.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03fab9c and fcd77ce.

📒 Files selected for processing (5)
  • frontend/__tests__/unit/components/ChapterMap.test.tsx
  • frontend/__tests__/unit/components/DonutBarChart.test.tsx
  • frontend/__tests__/unit/data/mockCommitteeDetailsData.ts
  • frontend/__tests__/unit/data/mockSnapshotData.ts
  • frontend/src/components/ChapterMap.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-03T03:08:03.290Z
Learnt from: ahmedxgouda
Repo: OWASP/Nest PR: 1703
File: frontend/src/components/BarChart.tsx:33-46
Timestamp: 2025-07-03T03:08:03.290Z
Learning: In the OWASP Nest project's BarChart component (frontend/src/components/BarChart.tsx), the days and requirements arrays are guaranteed to always have the same length in their use cases, so input validation for array length matching is not needed.

Applied to files:

  • frontend/__tests__/unit/components/DonutBarChart.test.tsx
🔇 Additional comments (5)
frontend/__tests__/unit/data/mockCommitteeDetailsData.ts (1)

4-4: LGTM! Timestamp correctly represented as integer.

The removal of the .0 suffix improves code consistency. Unix timestamps are conventionally represented as integers in JavaScript/TypeScript.

frontend/src/components/ChapterMap.tsx (1)

44-44: LGTM! Configuration value correctly simplified.

The change from 1.0 to 1 is functionally equivalent and improves code consistency. The corresponding test expectation has been correctly updated in ChapterMap.test.tsx.

frontend/__tests__/unit/data/mockSnapshotData.ts (1)

88-88: LGTM! Timestamp correctly represented as integer.

Consistent with other timestamp changes in this PR (e.g., mockCommitteeDetailsData.ts). The removal of the .0 suffix aligns with standard Unix timestamp representation.

frontend/__tests__/unit/components/ChapterMap.test.tsx (1)

144-144: LGTM! Test expectation correctly aligned with implementation.

The test expectation properly reflects the change in ChapterMap.tsx (line 44), ensuring the test continues to validate the correct map initialization configuration.

frontend/__tests__/unit/components/DonutBarChart.test.tsx (1)

340-340: LGTM! Test expectation correctly removes zero fractions.

The updated expectation correctly represents the rounded values without unnecessary .0 suffixes. The first two values (999999.999 and 1000000.001) round to integers (1000000), while the third value (2000000.5) appropriately retains its fractional part.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2026

@arkid15r arkid15r enabled auto-merge January 6, 2026 21:41
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

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

LGTM

@arkid15r arkid15r added this pull request to the merge queue Jan 6, 2026
Merged via the queue into OWASP:main with commit ae2b40c Jan 6, 2026
28 checks passed
anukalp2804 pushed a commit to anukalp2804/Nest that referenced this pull request Jan 12, 2026
* Remove unnecessary zero fractions from number literals

* Fix: remove unnecessary zero fractions across the codebase
hussainjamal760 added a commit to hussainjamal760/Nest that referenced this pull request Jan 14, 2026
* Remove unnecessary zero fractions from number literals

* Fix: remove unnecessary zero fractions across the codebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unnecessary zero fractions from number literals

2 participants

Comments