MeilCli/FoodSearch

View on GitHub

Showing 5 of 75 total issues

Method loadCategories has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private fun loadCategories(view: ISearchQueryView) = launch(onDestroyViewContext) {
        val largeCategoriesTask = async(ioDispatcher) { gnaviService.getLargeCategories() }

        withContext(mainDispatcher) {
            try {

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 getCheckedCategories has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    override fun getCheckedCategories(): Sequence<ICategory> {
        val categoryContainer = categoryView.successLayout?.categoryChipGroup ?: return emptySequence()

        return sequence {
            for (child in categoryContainer.getChildViews()) {

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 errorFromJson has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private fun errorFromJson(reader: JsonReader): Error {
        var message: String? = null
        var code: Int? = null

        while (reader.hasNext()) {

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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    override fun create(type: Type, annotations: MutableSet<out Annotation>, moshi: Moshi): JsonAdapter<*>? {
        return when (type) {
            Date::class.java -> Rfc3339DateJsonAdapter()
            Error::class.java -> ErrorJsonAdapter(moshi)
            Restaurant::class.java -> RestaurantJsonAdapter(moshi)

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 removeCategories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    override fun removeCategories(condition: (ICategory) -> Boolean) {
        val categoryContainer = categoryView.successLayout?.categoryChipGroup ?: return

        for (child in categoryContainer.getChildViews()) {
            val category = child.tag as? ICategory ?: continue

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

Severity
Category
Status
Source
Language