KhronosGroup / KhronosGroup/KSCAF_DocRequirements

Code complexity should be low

Open
#23 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
4
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Text entered:

Many of the safety standards require that the code is written in the least complex manor. Many software code quality assessment tools score code on its cyclomatic complexity. The less complex means there are likely less linearly independent paths through a program's source code which results in a lower score. A lower score is a better score and is an indication that the code is easier to understand and so modify with less chance of unforeseen behavior.

The API and its functions' signatures play an important part on how the implementation is coded. The number of parameters in a function should kept to a minimum to help reduce complexity.

If numerous parameters are required consider if they are necessary for immediately use or just passing through to other private functions. If that is the case it is good practice to encapsulate those parameters in to an object such as a 'C' structure. Use of a structure not only reduces the size of the function signature it helps reduce the complexity of the code supporting that function and so helps with code maintenance. Should it be required a function's parameter is no longer required or a new one is needed function signatures down the line also do not have to change to handle the change.

Contributor guide

No contributing guide indexed for this repository

Research direction

No file, test, or entry point is named. Review the repository's existing safety requirements structure and determine where this code-complexity guidance belongs; done means the requirement is incorporated consistently and its intended guidance is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.