Showing 246 of 862 total issues
Method fetchJob
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun fetchJob(jobId: String) {
CBOnlineLib.onlineV2JsonApi.getJobById(
jobId
).enqueue(
retrofitCallback { _, response ->
Method bindTo
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
/**
* Items might be null if they are not paged in yet. PagedListAdapter will re-bind the
* ViewHolder when Item is loaded.
*/
fun bindTo(content: ContentModel, onItemClick: ((ContentModel) -> Unit)?) {
Method bind
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun bind(doubt: Doubts) {
with(itemView) {
titleTv.text = doubt.title
descriptionTv.text = doubt.body
contentChip.text = doubt.content?.title
Method saveCode
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun saveCode(codeId: String, codeChallenge: CodeChallenge) {
val newCode: CodeChallengeModel = codeId.let {
with(codeChallenge.content!!) {
CodeChallengeModel(
Method onCreate
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_library)
setToolbar(libraryToolbar)
libraryToolbar.setNavigationOnClickListener {
Method onClick
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onClick(v: View) {
when (v.id) {
R.id.bottomSheetSaveBtn -> {
when ((v as Button).text) {
"Save" -> {
Method getStats
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
fun getStats() {
runIO {
when (val response = attemptId?.let { repo.getStats(it) }) {
is ResultWrapper.GenericError -> setError(response.error)
is ResultWrapper.Success -> with(response.value) {
- 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 bind
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
fun bind(doubt: Doubts) {
with(itemView) {
titleTv.text = doubt.title
descriptionTv.text = doubt.body
contentChip.text = doubt.content?.title
- 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 getLeaderboard
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
fun getLeaderboard() = liveData(Dispatchers.IO) {
when (val response = repo.fetchLeaderboard(runId!!)) {
is ResultWrapper.GenericError -> setError(response.error)
is ResultWrapper.Success -> with(response.value) {
if (isSuccessful) {
- 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 onResume
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
override fun onResume() {
super.onResume()
if (vm.isLoggedIn == true) {
vm.fetchTopRunWithStats().observe(
thisLifecycleOwner,
- 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 onViewCreated
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
viewModel.fetchSections()
typeChipGroup.setOnCheckedChangeListener { _, checkedId ->
when (checkedId) {
Method getView
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = convertView ?: LayoutInflater.from(parent.context).inflate(R.layout.item_bottomsheet, parent, false)
val sheetItem = getItem(position)
Method onViewCreated
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
pauseCancelBtn.setOnClickListener {
dismiss()
Method onCreate
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_track)
supportPostponeEnterTransition()
setToolbar(courseToolbar)
Method onViewCreated
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
vm.getCart()
if (vm.map["stateId"] != null)
checkoutBtn.isEnabled = true
Method onViewCreated
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
userIv.loadImage(viewModel.prefs.SP_USER_IMAGE)
usernameTv.text = viewModel.prefs.SP_USER_NAME
userIdTv.text = "Account Id :${viewModel.prefs.SP_ONEAUTH_ID}"
Method checkSection
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun checkSection(premium: Boolean) {
when {
viewModel.runStartEnd.first < System.currentTimeMillis() -> {
requireContext().showDialog(
"expired",
Method loadData
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun LineChart.loadData(
averageProgress: java.util.ArrayList<ProgressItem>,
userProgress: java.util.ArrayList<ProgressItem>
) {
val values: ArrayList<Entry> = ArrayList()
Method insertJobs
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
suspend fun insertJobs(jobs: List<Jobs>) {
jobs.forEach { job ->
with(job) {
val company = withContext(Dispatchers.IO) {
CBOnlineLib.onlineV2JsonApi.getCompany(company?.id ?: "")
- 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 createTile
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressLint("RestrictedApi")
private Drawable createTile(Drawable drawable, boolean clip) {
if (drawable instanceof DrawableWrapper) {
Drawable inner = ((DrawableWrapper) drawable).getWrappedDrawable();
if (inner != null) {