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

chore: Lint code #2834

Draft
wants to merge 18 commits into
base: dev
Choose a base branch
from
Draft

chore: Lint code #2834

wants to merge 18 commits into from

Conversation

oSumAtrIX
Copy link
Member

This commit also changes the API, but these changes are considered fixes.

This commit also changes the API, but these changes are considered fixes.
# Conflicts:
#	src/main/kotlin/app/revanced/patches/youtubevanced/ad/general/HideAdsPatch.kt
@oSumAtrIX
Copy link
Member Author

@LisoUseInAIKyrios If there are other rules you want to add to .editorconfig you can do so now

@LisoUseInAIKyrios
Copy link
Contributor

Can the trailing commas for kotlin be turned off? I think it looks a little messy when there's trailing commas for a variable argument function with a single parameter.

I cannot get Android Studio to add trailing commas to any code when using the code reformat function.
And Android Studio does not show any lint errors when using inspect or analyze code.

Should a lint task be added to the gradle config? So at least there's a unified way to run lint?

@oSumAtrIX
Copy link
Member Author

Ktlint is used for linting. An Android Studio plugin for it iirc exists. On save, the lint rules will be applied.
I agree; the trailing commas are indeed messy and should be disabled.

Ktlint also has a Gradle plugin that we can add. It will check for lining errors on build.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Mar 4, 2024

I found the KTLint plugin from the Android Studio plugin marketplace works corectly and can automatically fix lint errors as well.

Is there any reason the patches uses java language level 11 and not 17?

The project SDK is already java 17 and Integrations already uses language level 17 (Integrations uses language level 11)

It's a minor issue, but with Android Studio it always changes the misc.xml file to match the SDK and you have to manually change the project every time a new branch is opened.
changes

@oSumAtrIX
Copy link
Member Author

I am not entirely sure, but the version was set to 11 because of the assumption that 17 would compile incompatible bytecode for Android. Before Android 11, I believe, Java 11 was used as the target bytecode level.

@LisoUseInAIKyrios
Copy link
Contributor

Ok I see that Integration is using java 11 compatibility.

Looking closer, this setting is actually the language level. Not the bytecode output compatibility level.

The bytecode output level is set to 11 in another location:
jvm output compatibility

I think this language level setting can be changed to the SDK default.

@LisoUseInAIKyrios
Copy link
Contributor

@oSumAtrIX Try running organize imports on HideShortsComponentsPatch, and verify it does not reorganize the imports.

If it makes changes to the imports, then the lint rules need adjusting otherwise imports will keep changing between Intellij and Android Studio usage.

@oSumAtrIX
Copy link
Member Author

This is the output when I format the code:

Index: src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt
--- a/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt	(revision ab0af3ec572251b3d8f2b4c699460ed29794ac57)
+++ b/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt	(date 1709572468593)
@@ -31,7 +31,7 @@
         IntegrationsPatch::class,
         LithoFilterPatch::class,
         HideShortsComponentsResourcePatch::class,
-        ResourceMappingPatch::class
+        ResourceMappingPatch::class,
     ],
     compatiblePackages = [
         CompatiblePackage(
@@ -49,10 +49,10 @@
                 "19.02.39",
                 "19.03.35",
                 "19.03.36",
-                "19.04.37"
-            ]
-        )
-    ]
+                "19.04.37",
+            ],
+        ),
+    ],
 )
 @Suppress("unused")
 object HideShortsComponentsPatch : BytecodePatch(
@@ -61,8 +61,8 @@
         ReelConstructorFingerprint,
         BottomNavigationBarFingerprint,
         RenderBottomNavigationBarParentFingerprint,
-        SetPivotBarVisibilityParentFingerprint
-    )
+        SetPivotBarVisibilityParentFingerprint,
+    ),
 ) {
     private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/youtube/patches/components/ShortsFilter;"
 
@@ -80,7 +80,7 @@
                     insertIndex,
                     viewRegister,
                     FILTER_CLASS_DESCRIPTOR,
-                    "hideShortsShelf"
+                    "hideShortsShelf",
                 )
             }
         } // Do not throw an exception if not resolved.
@@ -117,7 +117,7 @@
                     addInstruction(
                         insertIndex,
                         "sput-object v$viewRegister, $FILTER_CLASS_DESCRIPTOR->pivotBar:" +
-                            "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;"
+                            "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;",
                     )
                 }
             }
@@ -144,7 +144,7 @@
                 addInstruction(
                     insertIndex,
                     "invoke-static { v$viewRegister }, $FILTER_CLASS_DESCRIPTOR->" +
-                        "hideNavigationBar(Landroid/view/View;)Landroid/view/View;"
+                        "hideNavigationBar(Landroid/view/View;)Landroid/view/View;",
                 )
             }
         } ?: throw BottomNavigationBarFingerprint.exception
@@ -155,7 +155,7 @@
     private enum class ShortsButtons(private val resourceName: String, private val methodName: String) {
         COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"),
         REMIX("reel_dyn_remix", "hideShortsRemixButton"),
-        SHARE("reel_dyn_share", "hideShortsShareButton")
+        SHARE("reel_dyn_share", "hideShortsShareButton"),
         ;
 
         fun injectHideCall(method: MutableMethod) {

I am not sure if the ktlint plugin is actually respecting the editorconfig file.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Mar 4, 2024

The ktlint plugin for Android Studio is working for me.

If I remove or change the trailing line settings in editorconfig and then do ktlint format, it will add or remove the trailing commas as specified by the config.

Because not everyone will have ktlint installed, the Gradle build task could run ktlint format on all code.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Mar 4, 2024

Maybe ktlint_code_style should be changed from intellij to android_studio (formerly named just android).

It will make intellij use formatting that is closer to Android Studio, and I think that automatic turns off trailing commas (which are not recommended for kotlin android).

@oSumAtrIX
Copy link
Member Author

Oh my bad, I am using IntelliJ IDEA exclusively, even for Integrations. Possibly we should have both, intellij idea as well as android studio linting rules for integrations

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Mar 4, 2024

As far as I know, Android studio does not have any lint code format warnings or checks. It only has code formatter settings.

If editorconfig is changed to use ktlint_code_style=android_studio, that will make Intellij and ktlint use Android Studio style code formatting, and remove the need for two different lint format files (since both intellij and Android studio will then use the same formatting rules).

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Mar 4, 2024

For me Android Studio is formatting code correctly, and ktlint is correctly removing trailing commas.

@oSumAtrIX Try on your end with intellij and see if it formats and does not use trailing commas.

@oSumAtrIX oSumAtrIX marked this pull request as draft March 12, 2024 13:00
tamnguyenchi93 pushed a commit to tamnguyenchi93/revanced-patches that referenced this pull request Mar 24, 2024
tamnguyenchi93 pushed a commit to tamnguyenchi93/revanced-patches that referenced this pull request Mar 24, 2024
# [2.188.0](ReVanced/revanced-patches@v2.187.0...v2.188.0) (2023-08-26)

### Bug Fixes

* allow using `PreferenceScreen` outside of current module ([fe94013](ReVanced/revanced-patches@fe94013))
* **Client spoof:** Remove exception from option ([9c69f87](ReVanced/revanced-patches@9c69f87))
* **Enable android debugging:** Update patch description ([ReVanced#2869](ReVanced/revanced-patches#2869)) ([d9f0d08](ReVanced/revanced-patches@d9f0d08))
* improve wording ([26f9b05](ReVanced/revanced-patches@26f9b05))
* **Reddit is Fun - Spoof client:** Use a more convincing user agent ([236a18f](ReVanced/revanced-patches@236a18f))
* remove newline ([545388b](ReVanced/revanced-patches@545388b))
* **Tiktok - Show seekbar:** Bump compatibility ([ReVanced#2737](ReVanced/revanced-patches#2737)) ([08413bd](ReVanced/revanced-patches@08413bd))
* **YouTube - Client spoof:** Adjust spoof signature settings description ([ReVanced#2760](ReVanced/revanced-patches#2760)) ([f71d893](ReVanced/revanced-patches@f71d893))
* **YouTube Music - Remove upgrade button:** Remove the correct navigation bar item ([fd3813f](ReVanced/revanced-patches@fd3813f))

### Features

* Add `Override certificate pinning` patch ([ReVanced#2781](ReVanced/revanced-patches#2781)) ([94ed738](ReVanced/revanced-patches@94ed738))
* **Change package name:** Append `.revanced` to package name by default ([ReVanced#2750](ReVanced/revanced-patches#2750)) ([e83e62f](ReVanced/revanced-patches@e83e62f))
* **Duolingo:** Add `Unlock Duolingo Super` patch ([ReVanced#2862](ReVanced/revanced-patches#2862)) ([61a7533](ReVanced/revanced-patches@61a7533))
* Exclude `Custom branding` patch by default ([d6de957](ReVanced/revanced-patches@d6de957))
* **Lightroom:** Add `Disable mandatory login` patch ([ReVanced#2738](ReVanced/revanced-patches#2738)) ([896a713](ReVanced/revanced-patches@896a713))
* **Lightroom:** Add `Unlock premium` patch ([ReVanced#2740](ReVanced/revanced-patches#2740)) ([e18a9bc](ReVanced/revanced-patches@e18a9bc))
* **Nova Launcher:** Remove `Unlock prime` patch ([bbde91c](ReVanced/revanced-patches@bbde91c))
* Publicize resource utility functions ([20aff26](ReVanced/revanced-patches@20aff26))
* **Solid Explorer:** Add `Remove file size limit` patch ([01c617d](ReVanced/revanced-patches@01c617d))
* **Strava:** Add `Subscription features` patch ([ReVanced#2872](ReVanced/revanced-patches#2872)) ([387eb29](ReVanced/revanced-patches@387eb29))
* **Tasker:** Remove `Unlock trial` patch ([8354a87](ReVanced/revanced-patches@8354a87))
* Use an extension property to create new exception when failing to resolve a fingerprint ([47eac14](ReVanced/revanced-patches@47eac14))
* **YouTube - Debug:** Logging of layout proto buffer strings ([ReVanced#2759](ReVanced/revanced-patches#2759)) ([189f719](ReVanced/revanced-patches@189f719))
* **YouTube - External downloads:** Recommend Seal instead of PowerTube ([ReVanced#2803](ReVanced/revanced-patches#2803)) ([082e067](ReVanced/revanced-patches@082e067))
* **YouTube - Hide video action buttons:** Hide individual action buttons ([ReVanced#2723](ReVanced/revanced-patches#2723)) ([220f694](ReVanced/revanced-patches@220f694))
* **YouTube Music - Exclusive audio playback:** Support latest version ([0861991](ReVanced/revanced-patches@0861991))
* **YouTube Music:** Add `Permanent repeat` patch ([ReVanced#2722](ReVanced/revanced-patches#2722)) ([506d49c](ReVanced/revanced-patches@506d49c))
* **YouTube Music:** Add `Permanent Shuffle` patch ([ReVanced#2730](ReVanced/revanced-patches#2730)) ([86a271c](ReVanced/revanced-patches@86a271c))
* **YouTube:** Add `Alternative thumbnails` patch ([ReVanced#2834](ReVanced/revanced-patches#2834)) ([8a4277c](ReVanced/revanced-patches@8a4277c))
* **YouTube:** Add `Custom player overlay opacity` patch ([ReVanced#2721](ReVanced/revanced-patches#2721)) ([2622b00](ReVanced/revanced-patches@2622b00))
* **YouTube:** Add `Enable tablet layout` patch ([c89b2aa](ReVanced/revanced-patches@c89b2aa))
* **YouTube:** Support version `18.29.38` ([c1b9eef](ReVanced/revanced-patches@c1b9eef))
* **YouTube:** Support version `18.32.39` ([7b503e2](ReVanced/revanced-patches@7b503e2))
# Conflicts:
#	api/revanced-patches.api
#	src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/HideTimelineAdsPatch.kt
#	src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/IsAdCheckTwoFingerprint.kt
#	src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/MediaFingerprint.kt
#	src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/MediaAdFingerprint.kt
#	src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/PaidPartnershipAdFingerprint.kt
#	src/main/kotlin/app/revanced/patches/instagram/patches/ads/timeline/fingerprints/ads/ShoppingAdFingerprint.kt
#	src/main/kotlin/app/revanced/patches/music/ad/video/MusicVideoAdsPatch.kt
#	src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsConstructorFingerprint.kt
#	src/main/kotlin/app/revanced/patches/music/ad/video/fingerprints/ShowMusicVideoAdsFingerprint.kt
#	src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt
#	src/main/kotlin/app/revanced/patches/music/layout/compactheader/CompactHeaderPatch.kt
#	src/main/kotlin/app/revanced/patches/music/layout/compactheader/fingerprints/ConstructCategoryBarFingerprint.kt
#	src/main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt
#	src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt
#	src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumFingerprint.kt
#	src/main/kotlin/app/revanced/patches/music/layout/premium/fingerprints/HideGetPremiumParentFingerprint.kt
#	src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt
#	src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/fingerprints/PivotBarConstructorFingerprint.kt
#	src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch.kt
#	src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/fingerprints/BackgroundPlaybackDisableFingerprint.kt
#	src/main/kotlin/app/revanced/patches/reddit/customclients/syncforreddit/ads/DisableAdsPatch.kt
#	src/main/kotlin/app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch.kt
#	src/main/kotlin/app/revanced/patches/tiktok/misc/integrations/fingerprints/InitFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsBytecodePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/autoplay/HideAutoplayButtonPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/captions/HideCaptionsButtonPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/ResolvePivotBarFingerprintsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarButtonsViewFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarCreateButtonViewFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/fingerprints/PivotBarEnumFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/utils/InjectionUtils.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/buttons/player/hide/HidePlayerButtonsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/albumcards/AlbumCardsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/comments/CommentsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/crowdfundingbox/CrowdfundingBoxPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndscreenCardsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/filterbar/HideFilterBarPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/floatingmicrophone/HideFloatingMicrophoneButtonPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/loadmorebutton/HideLoadMoreButtonPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/seekbar/HideSeekbarPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsResourcePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/suggestedvideoendscreen/DisableSuggestedVideoEndScreenPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/RestoreOldSeekbarThumbnailsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockBytecodePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/tabletminiplayer/TabletMiniPlayerPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/autorepeat/AutoRepeatPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/ClientSpoofPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/fix/playback/fingerprints/UserAgentHeaderBuilderFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/fingerprints/ComponentContextParserFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/navigation/fingerprints/InitializeButtonsFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/PlayerOverlaysHookPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/playeroverlay/fingerprint/PlayerOverlaysOnFinishInflateFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/video/hdrbrightness/HDRBrightnessPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt
#	src/main/kotlin/app/revanced/patches/youtube/video/videoqualitymenu/RestoreOldVideoQualityMenuPatch.kt
@LisoUseInAIKyrios
Copy link
Contributor

I tried IntelliJ, for me it is no longer adding trailing commas when reformatting code.

@oSumAtrIX If it's still adding trailing commas for you, then maybe it's a installation specific setting.

@oSumAtrIX
Copy link
Member Author

I have been using the dev branch instead of this one, so I'll verify again in a bit

@LisoUseInAIKyrios
Copy link
Contributor

For me, running Ktlint reformatusing the KTLint plugin in Android Studio correctly removes the trailing commas if they exist.

@oSumAtrIX
Copy link
Member Author

oSumAtrIX commented Mar 31, 2024

Perhaps we are using different plugins?
image

My plugin still insists on adding trailing commas.
Additionally, my IDE is reporting this warning, but I am not sure why:

image

More info I found about this: https://youtrack.jetbrains.com/issue/IDEA-336571

# Conflicts:
#	gradle.properties
#	src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt
#	src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt
@LisoUseInAIKyrios
Copy link
Contributor

I'm using the same plugin (works with both Intellij and Android Studio).

I think it's figured out now.
Adding the Intellij specific settings fixed it in IntelliJ for me:

ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_allow_trailing_comma = false

All the plugins now work correctly for me. IntelliJ ktlint format, Android Studio ktlint format, and gradle ktlintformat, all produce the same formatted output. Running a reformat in any of them will not create clashing changes.

If it's still behaving differently for you, check if you have local project specific format settings turned on, as that might be changing the behavior.

@LisoUseInAIKyrios
Copy link
Contributor

ktlintformat could be added as a dependent task to gradle compile, as it automatically fixes nearly all issues.

@LisoUseInAIKyrios
Copy link
Contributor

Organize import now gives the same results between both editors.

@oSumAtrIX Try using ktlint format and IntelliJ organize imports, and no changes should be made.

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

Successfully merging this pull request may close these issues.

None yet

2 participants