Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LongParameterList no longer recognizes ignored annotations in 1.19.0 #4355

Closed
ZacSweers opened this issue Dec 3, 2021 · 2 comments · Fixed by #4570
Closed

LongParameterList no longer recognizes ignored annotations in 1.19.0 #4355

ZacSweers opened this issue Dec 3, 2021 · 2 comments · Fixed by #4570
Labels

Comments

@ZacSweers
Copy link
Contributor

Expected Behavior

Prior to 1.19.0, this configuration worked to prevent LongParameterList warnings on constructors with a few "known" injection annotations from dagger.

LongParameterList:
  active: true
  functionThreshold: 7
  constructorThreshold: 7
  ignoreDefaultParameters: false
  ignoreDataClasses: true
  ignoreAnnotated: ['javax.inject.Inject', 'dagger.Provides', 'dagger.assisted.AssistedInject']

Observed Behavior

In 1.19.0, these seem to be ignored now

Steps to Reproduce

Here are some snippets that repro for us

class ActivityFeedPresenter @Inject constructor(
  private val activityApi: ActivityApi,
  private val userRepository: UserRepository,
  private val botsDataProvider: BotsDataProvider,
  private val mpdmDisplayNameHelper: MpdmDisplayNameHelper,
  private val prefsManager: PrefsManager,
  private val conversationRepo: ConversationRepository,
  private val lockedThreadTransformer: ActivityFeedLockedThreadTransformer,
  private val mentionItemFactoryLazy: Lazy<MentionItemFactory>,
) : ActivityFeedContract.Presenter, LoadingStateProvider {

class AppDialogFragment @AssistedInject constructor(
  private val appDialogsRepository: AppDialogsRepository,
  private val presenter: AppDialogPresenter?,
  private val keyboardHelper: KeyboardHelper,
  private val snackbarHelper: SnackbarHelper,
  private val appBuildConfig: AppBuildConfig,
  private val appDialogMenuBinder: AppDialogMenuBinder,
  private val appDialogMenuViewFactory: AppDialogMenuView.Factory,
  private val appDialogSelectViewFactory: AppDialogSelectView.Factory,
  private val appDialogTextViewFactory: AppDialogTextView.Factory,
  private val platformLogger: PlatformLogger,
  @ForScope(UserScope::class) private val fragmentNavRegistrar: FragmentNavRegistrar
) : ViewBindingFragment(),
  AppDialogContract.View,
  MenuSelectionListener,
  BackPressedListener {
  
class AppActionDelegateImpl @Inject constructor(
  private val appActionsRepository: Lazy<AppActionsRepository>,
  private val attachmentActionHelperLazy: Lazy<AttachmentActionHelper>,
  private val attachmentRepositoryLazy: Lazy<AttachmentRepository>,
  private val blockKitActionDelegateLazy: Lazy<BlockKitActionDelegate>,
  private val blockKitDialogHelperLazy: Lazy<BlockKitDialogHelper>,
  private val customTabHelperLazy: Lazy<CustomTabHelper>,
  private val formattedTextBinderLazy: Lazy<FormattedTextBinder>,
  private val messageActionsHelperLazy: Lazy<MessageActionsHelper>,
  private val commandRepository: Lazy<CommandRepository>,
  private val platformEventHandler: Lazy<PlatformEventHandler>,
  private val toasterLazy: Lazy<Toaster>,
  private val typefaceSubstitutionHelperLazy: Lazy<TypefaceSubstitutionHelper>,
  private val networkInfoManagerLazy: Lazy<NetworkInfoManager>,
  private val platformAppsManagerLazy: Lazy<PlatformAppsManager>,
  private val messageDaoLazy: Lazy<MessageDao>,
  private val messageEventBroadcasterLazy: Lazy<MessageEventBroadcaster>,
  private val slackActionDelegateLazy: Lazy<SlackActionDelegate>,
  private val snackbarDelegate: SnackbarDelegate,
  private val blockKitStateProvider: BlockKitStateProvider,
  private val triggerResolver: TriggerResolver,
  @ForLegacyFeature(MOBILE_INPUT_BLOCKS_IN_MESSAGES) private val isMobileInputBlocksInMessagesEnabled: Boolean
) : AppActionDelegate, SnackbarDelegate by snackbarDelegate {

Context

It is a regression

Your Environment

  • Version of detekt used: 1.19.0
  • Version of Gradle used (if applicable): N/A
  • Gradle scan link (add --scan option when running the gradle task): private repo
  • Operating System and version: macOS 11
  • Link to your project (if it's a public repository): N/A
@ZacSweers ZacSweers added the bug label Dec 3, 2021
@BraisGabin
Copy link
Member

I assume that you are not using type solving. I need to check how the old implementation was getting the full qualified names...

As a "workaround" you can use the name of the annotation instead of the full qualified name. Or enable type solving.

@ZacSweers
Copy link
Contributor Author

Yeah type solving is a nonstarter for us as we run this via CLI in a commit hook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants