Skip to content

Refactor OWASP risk calculation system and improve code organiz…#36

Merged
drneox merged 1 commit intomainfrom
fix-calculate
Sep 5, 2025
Merged

Refactor OWASP risk calculation system and improve code organiz…#36
drneox merged 1 commit intomainfrom
fix-calculate

Conversation

@drneox
Copy link
Copy Markdown
Owner

@drneox drneox commented Sep 5, 2025

…ation

  • Fix real-time risk calculation updates in Analysis component
  • Implement 1 decimal place formatting for risk values (was showing 2 decimals)
  • Create centralized risk calculation utilities in utils/riskCalculations.js
  • Extract textarea helpers to utils/textareaHelpers.js for reusability
  • Add RiskDisplay component for consistent risk value presentation
  • Add ResidualRiskSelector component with invisible overlay approach
  • Remove duplicate functions: createCurrentRiskDisplay, createResidualRiskSelector
  • Consolidate getRiskValue functions into generic implementation
  • Clean up unused variables and imports (expandedSections, toggleSection, ThreatCard)
  • Translate all Spanish comments to English for professional standards
  • Add ESLint suppressions for appropriate edge cases
  • Maintain backward compatibility with existing API structure
  • All 79 frontend tests passing successfully

Technical improvements:

  • Better state management with direct React state references
  • Modular component architecture with separated concerns
  • Consistent 1-decimal OWASP risk formatting: (Likelihood + Impact) / 2
  • Eliminated ~200 lines of redundant code from Analysis.jsx
  • Enhanced maintainability and code readability

…ation

- Fix real-time risk calculation updates in Analysis component
- Implement 1 decimal place formatting for risk values (was showing 2 decimals)
- Create centralized risk calculation utilities in utils/riskCalculations.js
- Extract textarea helpers to utils/textareaHelpers.js for reusability
- Add RiskDisplay component for consistent risk value presentation
- Add ResidualRiskSelector component with invisible overlay approach
- Remove duplicate functions: createCurrentRiskDisplay, createResidualRiskSelector
- Consolidate getRiskValue functions into generic implementation
- Clean up unused variables and imports (expandedSections, toggleSection, ThreatCard)
- Translate all Spanish comments to English for professional standards
- Add ESLint suppressions for appropriate edge cases
- Maintain backward compatibility with existing API structure
- All 79 frontend tests passing successfully

Technical improvements:
- Better state management with direct React state references
- Modular component architecture with separated concerns
- Consistent 1-decimal OWASP risk formatting: (Likelihood + Impact) / 2
- Eliminated ~200 lines of redundant code from Analysis.jsx
- Enhanced maintainability and code readability
@drneox drneox merged commit 57adaff into main Sep 5, 2025
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.

1 participant