Showing 246 of 862 total issues
Method onClick
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onClick(v: View) {
var hideAfterTimeout = true
if (player == null) return
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) {
Method onViewCreated
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
runsRv.setRv(requireContext(), runListAdapter, true)
selectionTracker = SelectionTracker.Builder<String>(
"mySelection",
Method setUpQuestionBottomSheet
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun setUpQuestionBottomSheet(size: Int) {
var count = 0
var rowLayout = LinearLayout(context)
rowLayout.layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
Method onConfigurationChanged
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onConfigurationChanged(newConfig: Configuration) {
val newOrientation = newConfig.orientation
val oldOrientation = vm.currentOrientation
vm.currentOrientation = newOrientation
super.onConfigurationChanged(newConfig)
Method onCreate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_spin_win)
setToolbar(campaignToolbar)
pagerAdapter.apply {
Method onClick
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onClick(item: BaseModel) {
when (item) {
is ContentLecture -> startActivity(
createVideoPlayerActivityIntent(requireContext(), item.lectureContentId, item.lectureSectionId)
)
Method getOfflineContent
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
suspend fun getOfflineContent(codeId: String): CodeChallenge? {
val model: CodeChallengeModel? = codeDao.getCodeChallengeById(codeId)
val challenge = with(model!!) {
CodeChallenge(
Method onViewCreated
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
GlideApp.with(requireContext())
.load(R.drawable.wheel)
.into(imageView)
Method initializeDownload
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun initializeDownload(mOtp: String, mPlaybackInfo: String, videoId: String) {
val optionsDownloader = OptionsDownloader()
// assuming we have otp and playbackInfo
optionsDownloader.downloadOptionsWithOtp(
mOtp,
Method crossfade
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun View.crossfade(view: View, otherView: View?, type: Int = View.INVISIBLE) {
this.apply {
// Set the content view to 0% opacity but visible, so that it is visible
// (but fully transparent) during the animation.
if (otherView == null && !isVisible) {
Method findUser
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun findUser(userMap: HashMap<String, String>) {
runIO {
when (val response = repo.findUser(userMap)) {
is ResultWrapper.GenericError -> setError(response.error)
is ResultWrapper.Success -> {
Method doWork
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
override suspend fun doWork(): Result {
val notesDao: NotesDao by inject()
val noteId = workerParameters.inputData.getString("NOTE_ID")
val noteJson = workerParameters.inputData.getString("NOTE")
val doubtJson = workerParameters.inputData.getString("DOUBT")
Method initializeDownload
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun initializeDownload(mOtp: String, mPlaybackInfo: String, videoId: String) {
val optionsDownloader = OptionsDownloader()
optionsDownloader.downloadOptionsWithOtp(
mOtp, mPlaybackInfo,
object : OptionsDownloader.Callback {
Method showReportDialog
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun showReportDialog() {
val dialog = AlertDialog.Builder(this).create()
val view = layoutInflater.inflate(R.layout.report_dialog, null)
view.primaryBtn.setOnClickListener {
Method assignLeaderBoardResponse
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
private fun assignLeaderBoardResponse(response: ResultWrapper<Response<JSONAPIDocument<List<DoubtLeaderBoard>>>>) {
when (response) {
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 getView
has a Cognitive Complexity of 27 (exceeds 20 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)
- 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 a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
adminTabLayout.addOnTabSelectedListener(this)
- 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 setUpFilterChips
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fun setUpFilterChips() {
liveDoubtBtn.setOnClickListener {
viewModel.type.value = ALL
}
Method animateVisibility
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
fun View.animateVisibility(visible: Int) {
if (visible == View.VISIBLE) {
visibility = View.VISIBLE
alpha = 0f
scaleX = 0f