Showing 28 of 50 total issues
Method startRecording
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@SuppressLint("Permissions are checked before calling this method", "MissingPermission")
private fun startRecording() {
// Initialize the AudioRecord
audioRecorder = AudioRecord(
audioSource,
Method addBadgeToUser
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Adds the given badge to the provided user.
* If no badge is provided, a default test badge will be added
* To get the user, LocalContext.current can be used
*/
Method loopXMLDocument
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
// Helper Function to loop through the input file's XML content until reaching the end of the document and writes the note at the desired location.
private fun loopXMLDocument(
eventType: Int,
parser: XmlPullParser,
xmlSerializer: XmlSerializer,
Method goHomePage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
/**
* Sets up the home page with the navigation drawer.
*/
private fun goHomePage() {
//set the layout
Method onCreateView
has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring. Open
Open
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method loopXMLDocument
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
eventType: Int,
parser: XmlPullParser,
xmlSerializer: XmlSerializer,
currentNoteLocation: Int,
noteLocation: Int,
Avoid deeply nested control flow statements. Open
Open
if (eventType == XmlPullParser.START_TAG && parser.name == "duration") {
// Parse the duration value
eventType = parser.next()
// Calculate the quarter note equivalent of the duration
val noteDuration = parser.text.toDouble() / divisions * 2.0
Method onCreateView
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
Open
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"