How to Exclude Files/Folders for SwiftLint Using CocoaPods?












3















The Problem



When building my xcode Swift project, I am getting violations from SwiftLint (i.e. Empty Count Violations) of files/folders that I exclude in my .swiftlint.yml file, but when specifying those files/folders in the excluded section, the violations still occur.



Code



.swiftlint.yml



included:

excluded:
- Pods
- myproject/API/api_implementation.swift
- myproject/API


Build Phases Run Script



"${PODS_ROOT}/SwiftLint/swiftlint"


Project Structure



/projectroot
.swiftlint.yml
Pods/
myproject/
API/
api_implementation.swift


Neither myproject/API/api_implementation.swift nor the entire directory myproject/API/ are excluded from the lint!



The Question



What is incorrect in terms of making this file and folder excluded from the lint? If my syntax is incorrect, what is the correct syntax? If my path is incorrect, where is the SwiftLint file run from? Interestingly, even though the .swiftlint.yml file is in the root of my project, the swiftlint file that is run is in Pods/SwiftLint/



Perhaps the way that Cocoapods requires additional integration for SwiftLint to work would cause this problem. I have tried, however, to empty the Build Phases Run Script, and have confirmed that the .swiftlint.yml file is indeed running on build.



Any help or thoughts would be appreciated!










share|improve this question





























    3















    The Problem



    When building my xcode Swift project, I am getting violations from SwiftLint (i.e. Empty Count Violations) of files/folders that I exclude in my .swiftlint.yml file, but when specifying those files/folders in the excluded section, the violations still occur.



    Code



    .swiftlint.yml



    included:

    excluded:
    - Pods
    - myproject/API/api_implementation.swift
    - myproject/API


    Build Phases Run Script



    "${PODS_ROOT}/SwiftLint/swiftlint"


    Project Structure



    /projectroot
    .swiftlint.yml
    Pods/
    myproject/
    API/
    api_implementation.swift


    Neither myproject/API/api_implementation.swift nor the entire directory myproject/API/ are excluded from the lint!



    The Question



    What is incorrect in terms of making this file and folder excluded from the lint? If my syntax is incorrect, what is the correct syntax? If my path is incorrect, where is the SwiftLint file run from? Interestingly, even though the .swiftlint.yml file is in the root of my project, the swiftlint file that is run is in Pods/SwiftLint/



    Perhaps the way that Cocoapods requires additional integration for SwiftLint to work would cause this problem. I have tried, however, to empty the Build Phases Run Script, and have confirmed that the .swiftlint.yml file is indeed running on build.



    Any help or thoughts would be appreciated!










    share|improve this question



























      3












      3








      3








      The Problem



      When building my xcode Swift project, I am getting violations from SwiftLint (i.e. Empty Count Violations) of files/folders that I exclude in my .swiftlint.yml file, but when specifying those files/folders in the excluded section, the violations still occur.



      Code



      .swiftlint.yml



      included:

      excluded:
      - Pods
      - myproject/API/api_implementation.swift
      - myproject/API


      Build Phases Run Script



      "${PODS_ROOT}/SwiftLint/swiftlint"


      Project Structure



      /projectroot
      .swiftlint.yml
      Pods/
      myproject/
      API/
      api_implementation.swift


      Neither myproject/API/api_implementation.swift nor the entire directory myproject/API/ are excluded from the lint!



      The Question



      What is incorrect in terms of making this file and folder excluded from the lint? If my syntax is incorrect, what is the correct syntax? If my path is incorrect, where is the SwiftLint file run from? Interestingly, even though the .swiftlint.yml file is in the root of my project, the swiftlint file that is run is in Pods/SwiftLint/



      Perhaps the way that Cocoapods requires additional integration for SwiftLint to work would cause this problem. I have tried, however, to empty the Build Phases Run Script, and have confirmed that the .swiftlint.yml file is indeed running on build.



      Any help or thoughts would be appreciated!










      share|improve this question
















      The Problem



      When building my xcode Swift project, I am getting violations from SwiftLint (i.e. Empty Count Violations) of files/folders that I exclude in my .swiftlint.yml file, but when specifying those files/folders in the excluded section, the violations still occur.



      Code



      .swiftlint.yml



      included:

      excluded:
      - Pods
      - myproject/API/api_implementation.swift
      - myproject/API


      Build Phases Run Script



      "${PODS_ROOT}/SwiftLint/swiftlint"


      Project Structure



      /projectroot
      .swiftlint.yml
      Pods/
      myproject/
      API/
      api_implementation.swift


      Neither myproject/API/api_implementation.swift nor the entire directory myproject/API/ are excluded from the lint!



      The Question



      What is incorrect in terms of making this file and folder excluded from the lint? If my syntax is incorrect, what is the correct syntax? If my path is incorrect, where is the SwiftLint file run from? Interestingly, even though the .swiftlint.yml file is in the root of my project, the swiftlint file that is run is in Pods/SwiftLint/



      Perhaps the way that Cocoapods requires additional integration for SwiftLint to work would cause this problem. I have tried, however, to empty the Build Phases Run Script, and have confirmed that the .swiftlint.yml file is indeed running on build.



      Any help or thoughts would be appreciated!







      xcode cocoapods swiftlint






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 23 '18 at 14:09







      gpsugy

















      asked Jul 20 '18 at 19:12









      gpsugygpsugy

      294213




      294213
























          1 Answer
          1






          active

          oldest

          votes


















          0














          The syntax and content of your .swiftlint.yml looks correct to me, but I wonder if the problem comes down to Groups vs Folders in Xcode?



          SwiftLint only looks at the location of the source files on disk rather than using the hierarchy shown in the Project Navigator in Xcode. You need to make sure that the files you expect to be excluded are definitely in the API directory when you look in Finder, and not just the API group in Xcode.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51449003%2fhow-to-exclude-files-folders-for-swiftlint-using-cocoapods%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The syntax and content of your .swiftlint.yml looks correct to me, but I wonder if the problem comes down to Groups vs Folders in Xcode?



            SwiftLint only looks at the location of the source files on disk rather than using the hierarchy shown in the Project Navigator in Xcode. You need to make sure that the files you expect to be excluded are definitely in the API directory when you look in Finder, and not just the API group in Xcode.






            share|improve this answer




























              0














              The syntax and content of your .swiftlint.yml looks correct to me, but I wonder if the problem comes down to Groups vs Folders in Xcode?



              SwiftLint only looks at the location of the source files on disk rather than using the hierarchy shown in the Project Navigator in Xcode. You need to make sure that the files you expect to be excluded are definitely in the API directory when you look in Finder, and not just the API group in Xcode.






              share|improve this answer


























                0












                0








                0







                The syntax and content of your .swiftlint.yml looks correct to me, but I wonder if the problem comes down to Groups vs Folders in Xcode?



                SwiftLint only looks at the location of the source files on disk rather than using the hierarchy shown in the Project Navigator in Xcode. You need to make sure that the files you expect to be excluded are definitely in the API directory when you look in Finder, and not just the API group in Xcode.






                share|improve this answer













                The syntax and content of your .swiftlint.yml looks correct to me, but I wonder if the problem comes down to Groups vs Folders in Xcode?



                SwiftLint only looks at the location of the source files on disk rather than using the hierarchy shown in the Project Navigator in Xcode. You need to make sure that the files you expect to be excluded are definitely in the API directory when you look in Finder, and not just the API group in Xcode.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 27 '18 at 20:55









                rodhanrodhan

                30617




                30617
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51449003%2fhow-to-exclude-files-folders-for-swiftlint-using-cocoapods%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Contact image not getting when fetch all contact list from iPhone by CNContact

                    count number of partitions of a set with n elements into k subsets

                    A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks