Giter Club home page Giter Club logo

pecker's Introduction

Notice: The "dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib" or missing warnings are caused by a SwiftSyntax issue, SwiftSyntax with Swift 5.1.

Pecker

Pecker detects unused code. It's based on IndexStoreDB and SwiftSyntax.

Chinese Readme: 中文版readme.

Motivation

As your Swift project codebase grows, it is hard to locate unused code. You need to tell if some constructs are still in used. pecker does this job for you, easy and accurate.

Features

pecker detects the following Swift constructs:

  1. class
  2. struct
  3. enum
  4. protocol
  5. func
  6. typealias
  7. operator

Installation

There're more than one way to install pecker.

Using Homebrew

$ brew install woshiccm/homebrew-tap/pecker

Using CocoaPods:

pod 'Pecker'

This will download the pecker binaries and dependencies in Pods/ during your next run of pod install and will allow you to invoke it via ${PODS_ROOT}/Pecker/bin/pecker in your script build phases.

This is the recommended way to install a specific version of pecker since it supports installing a specific stable version rather than head version.

Using Mint:

mint install woshiccm/Pecker

Compiling from source

$ git clone https://github.com/woshiccm/Pecker.git
$ cd Pecker
$ make install

With that installed and in the bin folder, now it's ready to serve.

Usage

Xcode

Integrate pecker into an Xcode scheme to get warnings and errors displayed in the IDE. Just add a new "Run Script Phase" with:

if which pecker >/dev/null; then
  pecker
else
  echo "warning: Pecker not installed, download from https://github.com/woshiccm/Pecker"
fi

Alternatively, if you've installed Pecker via CocoaPods the script should look like this:

${PODS_ROOT}/Pecker/bin/pecker

Terminal

Note:

  1. In terminal, since project index path can't be retrieved automatically there, so you need to set index path through -i/--index-store-path
  2. Need to set reporter as json and set output_file, the path can be both relative and absolute. If output_file is not specified, it defaults to be pecker.result.json in your project.

For example:

In .pecker.yml, the configuration is:

reporter: "json"
output_file: pecker.result.json

In terminal, you input:

$ pecker --path /Users/ming/Desktop/Testttt -i /Users/ming/Library/Developer/Xcode/DerivedData/Testttt-aohluxvofrwtfagozexmpeifvryf/Index/DataStore

Command Line

pecker [OPTIONS]
  • -v/--version: Prints the pecker version and exits.
  • --config: The custom path for configuration yaml file.
  • -i/--index-store-path: The Index path of your project, if unspecified, the default is ~Library/Developer/Xcode/DerivedData/{your project}/Index/DataStore.

Run pecker in the project target to detect. Project will search Swift files recursively.

Rules

Current only 5 rules are included in Pecker, They are skip_public, xctest, attributes, xml, comment. You can add them to disabled_rules if you don't need it. You can also check Source/PeckerKit/Rules directory to see their implementation.

skip_public

This rule means skip detect public class, struct, function, etc. Usually the public code is provided for other users, so it is difficult to determine whether it is used. So we don't detect it by default. But in some cases, such as using submodule to organize code, you need to detect public code, you can add it to disabled_rules.

xctest

XCTest is special, we stipulate that ignore classes inherited from XCTestCase and functions of this class that hasPrefix "test" and do not contain parameters.

class ExampleUITests: XCTestCase {

    func testExample() { //used
    }

    func test(name: String) { // unused
    }
    
    func get() { // unused
    }
}

attributes

If a Declaration contains the attribute in BlackListAttribute, skip. Such as IBAction, we are continuously collecting, if you find new cases, please let us know.

@IBAction func buttonTap(_ sender: Any) { // used       
}

XML

If code is being used in .xib or storyboard, we say it's in use.

comment

Code can be ignored with a comment inside a source file with the following format:

  • Ignore specified code
// pecker:ignore 

For example:

// pecker:ignore
class TestCommentObject { // skip
    
    // pecker:ignore
    func test1() { // skip
    }
    
    func test2() { // unused
    }
}
  • Ignore all symbols under scope
// pecker:ignore all

For example:

// pecker:ignore all
class TestCommentObject { // skip
    
    func test1() { // skip
    }
    
    struct SubClass { // skip
        
        func test2() { // skip
        }
    }
}

Other rules

These rules are used by default, you cannot configure them.

override

Skip declarations that override another. This works for both subclass overrides & protocol extension overrides.

protocol ExampleProtocol {
	func test() // used
}

class Example: ExampleProtocol {
    func test() { // used
    }
}

class Animal {
    func run() {  // used
    }
}

class Dog: Animal {
    override func run() { // used
    }
}

extensions

Referenced elsewhere means used, except for extensions.

class UnusedExample { // unused
    
}

extension UnusedExample {
    
}

Configuration

This is optional, will use default, if unspecified. Configure pecker by adding a .pecker.yml file from the directory you'll run pecker from. The following parameters can be configured:

Rule inclusion:

  • disabled_rules: Disable rules from the default enabled set.

Reporter inclusion:

  • xcode: Warnings displayed in the IDE.

  • json: you can set path by output_file, and the path can be both relative and absolute path, if unspecified, the default is pecker.result.json in current project directory.

reporter: "xcode"

disabled_rules:
  - skip_public

included: # paths to include during detecting. `--path` is ignored if present.
  - ./
  
excluded: # paths to ignore during detecting. Takes precedence over `included`.
  - Carthage
  - Pods

excludedGroupName: # names of group to ignore during detecting.
  - SwiftPeckerTestUITests

blacklist_files: # files to ignore during detecting, only need to add file name, the file extension default is swift.
  - HomeViewController

blacklist_symbols: # symbols to ignore during detecting, contains class, struct, enum, etc.
  - AppDelegate
  - viewDidLoad

blacklist_superclass: # all the class inherit from class specified in the list will ignore
  - UITableViewCell

# If output_file is not specified, the defaults to be pecker.result.json in your project

output_file: pecker.result.jsonthe path can be both relative and absolute.

Contributions and support

pecker is developed completely in the open.

Any contributing and pull requests are warmly welcome. If you are interested in developing pecker, submit ideas and submit pull requests!

Licence

pecker is released under the MIT License.

pecker's People

Contributors

congliu0704 avatar coolhandluke88 avatar godrm avatar heyvito avatar hodovani avatar noahsark769 avatar rastersize avatar sinchang avatar tackgyu avatar woshiccm avatar yume190 avatar zagahr avatar zntfdr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pecker's Issues

False Positive - Extension Principle Class

If you have an extension (such as a Notification Service Extension) then you end up with a class called NotificationService (this can be changed).

Apple knows to run this because of an entry in the Info.plist "NSExtensionPrincipalClass" which equals "$(PRODUCT_MODULE_NAME).NotificationService".

Pecker is raising a warning for this main class, but it is in fact being used.

Custom path of configuration file

Hi,

First of all, thanks for great tool. Amazing job 💪

I found one missed thing that is nice to have. It is custom path for configuration yaml file. For example, SwiftLint allows it in the following way:

${PODS_ROOT}/SwiftLint/swiftlint --config ../.swiftlint.yml

Does it make sense for you? Could you, please, provide something similar?

Request: Blacklist positives with a comment

We have a few true positives in our codebase which we'd like to keep around since they're not used yet but will soon be used. It would be nice if we could disable the pecker checker with a comment, similar to Swiftlint. Something like:

func myUnsusedFunction() { // pecker:ignore
}

// or:

// pecker:ignore:next
func myUnusedFunction() {
  print("Blah")
}

False positive for functions from protocol

protocol SomeProtocol {
  func doSomething()
}
class Implementation: SomeProtocol {
  func doSomething() { // Warning
  }
}

doSomething is called from other code via the protocol

Pecker seems to be broken in Xcode 11.4

I'm integrating Pecker via Run Script Phase.
It stopped working as soon as I upgraded Xcode to version 11.4.

Pecker version: 0.1.0

Error:
Command PhaseScriptExecution failed with a nonzero exit code

There isn't much info besides this:

bash PhaseScriptExecution Run\ Pecker /Users/fernando.fernandes/Library/Developer/Xcode/DerivedData/TEST-awvaoxeibgfjlqccvsjwuqsmgoij/Build/Intermediates.noindex/TEST.build/Debug-iphoneos/TEST.build/Script-0765326C23FF1DBB00BB6B45.sh (in target 'TEST' from project 'TEST') cd /Users/fernando.fernandes/Downloads/source/backslash-f/TEST/Xcode/TEST /bin/sh -c /Users/fernando.fernandes/Library/Developer/Xcode/DerivedData/TEST-awvaoxeibgfjlqccvsjwuqsmgoij/Build/Intermediates.noindex/TEST.build/Debug-iphoneos/TEST.build/Script-0765326C23FF1DBB00BB6B45.sh

Please advise, thanks.

XCTestRule false positive if using subclass of XCTestCase

I'm getting a warning "Pecker: function testSomeFunction() was never used; consider removing it" in a test class. This is true for any test function in a class which doesn't immediately subclass XCTestCase.

class FooTests: XCTestCase {
  func testSomething() { // No Warning
  }
}

class BarTests: FooTests {
  func testSomethingElse() { // Warning
  }
}

Given that it's still a valid test class, I wouldn't expect this to raise a warning! (Temporary workaround has just been to exclude the tests directory, though this isn't ideal)

Request: Blacklist @objc methods

Since Pecker reports Swift methods that are only used by Obj-C code as unused, it would be nice to have an option to remove methods/properties annotated with @objc from reporting.

Can't compile on Apple Silicone M1

/redacted/Pecker/.build/checkouts/swift-syntax/Sources/SwiftSyntax/SyntaxParser.swift:195:57: error: missing argument for parameter #3 in call
    let c_top = swiftparse_parse_string(c_parser, source)
                                                        ^
                                                        , <#Int#>
_InternalSwiftSyntaxParser.swiftparse_parse_string:1:13: note: 'swiftparse_parse_string' declared here
public func swiftparse_parse_string(_: swiftparse_parser_t!, _ source: UnsafePointer<CChar>!, _ len: Int) -> swiftparse_client_node_t!
            ^

make: *** [build] Error 1

Warning for Methods in Protocol when satisfying conformance in extension

protocol Protocol {
var variable: Bool { get }
func function(parameter: String?) -> String?
}

Implementing this Protocol in a class and satisfying conformance in extension works for variable but not for function.

class Class: Protocol { }

extension Class {
var variable: Bool { // no warning
return "Temp"
}

func function (parameter: String?) -> { // warning
return parameter
}
}

Types used as typecasting

Structure Types if used in typecasting while decoding the Data using Codable protocol using "as" keyword creating a warning.

False Positive: Subclasses of subclasses of XCTestCase

If you have a subclass of XCTestCase (e.g. a BaseTestCase where you put your generic testing utilities), Pecker currently reports tests that inherit from this subclass these as unused. For example:

import XCTest

class BaseTestCase: XCTestCase {

}

extension BaseTestCase {
    func a() {
        print("a")
    }
}

class TestCase: BaseTestCase { // currently reported as unused
    func test() { // currently reported as unused
        self.a()
    }
}

Working example in repo: https://github.com/noahsark769/NGPeckerExamples/blob/master/NGPeckerExamplesTests/XCTestSuperclassMethodUsedBySubclass.swift#L11

Confusing Usage instructions in README

The Usage section of the readme tells us to “Integrate pecker into an Xcode scheme to get warnings and errors displayed in the IDE. Just add a new "Run Script Phase" with:” but as far as I know, that's not possible as-written:

  • Xcode Targets have Build Phases, with a “New Run Script Phase” menu item.
    Screen Shot 2023-02-05 at 4 47 51 PM
  • Xcode Schemes have Pre-actions and Post-actions for the Build action, with a “New Run Script Action” menu item.
    Screen Shot 2023-02-05 at 4 48 27 PM

So this looks like a minor typo but stilll begs the question: What was meant here?

  • If an Xcode scheme, change “Run Script Phase”→“Run Script Action”, and it should say whether this should be a pre-action or a post-action.
  • If an Xcode target, change “Xcode scheme”→“Xcode target”, and it should say where in the list to order the phase (at the end after Copy Files, at the beginning just after Target Dependencies and Run Build Tool Plug-ins, etc.)

"Illegal instruction: 4" when running with output_file

With the following .pecker.yml:

reporter: "json"

disabled_rules:
  - skip_public
  
excluded: # paths to ignore during detecting. Takes precedence over `included`.
  - Carthage
  - Pods

blacklist_symbols: # symbols to ignore during detecting, contains class, struct, enum, etc.
  - AppDelegate
  - viewDidLoad

output_file: "./peckerout"

I get an illegal instruction when running pecker on CIFilter.io:

$ BUILD_ROOT=~/Library/Developer/Xcode/DerivedData/CIFilter.io-hibrtvbjsqlofacdruluolzdaqib/Index/DataStore/ pecker ./
Illegal instruction: 4

If I remove the output_file line, the script runs correctly.

Request: Cocoapods Support

We currently install Swiftlint with Cocoapods, so it would be really nice to have Pecker support for Cocoapods as well. Currently the install process requires manually cloning the project, so it won't get installed automatically when new developers clone our repo. Another option could be to integrate the project as a Swift package - that technically might work now? I'm not sure how to integrate a Swift package for development and not build it into the app, though

False Positive: SwiftUI Previews

By default, SwiftUI generates a struct which conforms to PreviewProvider, e.g.:

import SwiftUI

struct SettingsView: View {
    var body: some View {
        ...
    }
}

#if DEBUG
struct SettingsView_Previews: PreviewProvider {
    static var previews: some View {
        SettingsView()
    }
}
#endif

In the default configuration, pecker reports SettingsView_Previews as unused. It would be good to add a rule to ignore structs which conform to PreviewProvider.

Document BUILD_ROOT when running from command line

Pecker currently requires the BUILD_ROOT environment variable to be set, if an index store path is not passed. Without a BUILD_ROOT, it fails silently. It would be good to document that this is required as an env var.

In an ideal world, we could also provide the user a commend line option to specify the name of the target - then we could infer a default DerivedData path to use for the IndexDB

Cannot install Pecker on macOS Big Sur 11.3 (beta)

I cannot install Pecker on Big Sur (possibly due to being beta, but maybe you know).

If trying via Homebrew it throws an error, and trying a manual install via make install throws the following build error:

Cloning https://github.com/apple/swift-argument-parser.git
Resolving https://github.com/apple/swift-argument-parser.git at main
warning: Swift compiler no longer supports statically linking the Swift libraries. They're included in the OS by default starting with macOS Mojave 10.14.4 beta 3. For macOS Mojave 10.14.3 and earlier, there's an optional Swift library package that can be downloaded from "More Downloads" for Apple Developers at https://developer.apple.com/download/more/
warning: Swift compiler no longer supports statically linking the Swift libraries. They're included in the OS by default starting with macOS Mojave 10.14.4 beta 3. For macOS Mojave 10.14.3 and earlier, there's an optional Swift library package that can be downloaded from "More Downloads" for Apple Developers at https://developer.apple.com/download/more/
warning: Swift compiler no longer supports statically linking the Swift libraries. They're included in the OS by default starting with macOS Mojave 10.14.4 beta 3. For macOS Mojave 10.14.3 and earlier, there's an optional Swift library package that can be downloaded from "More Downloads" for Apple Developers at https://developer.apple.com/download/more/
/Users/christian/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:32: warning: initialization of 'UnsafeMutablePointer<yaml_version_directive_t>' (aka 'UnsafeMutablePointer<yaml_version_directive_s>') results in a dangling pointer
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/christian/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:53: note: implicit argument conversion from 'yaml_version_directive_t' (aka 'yaml_version_directive_s') to 'UnsafeMutablePointer<yaml_version_directive_t>' (aka 'UnsafeMutablePointer<yaml_version_directive_s>') produces a pointer valid only for the duration of the call to 'init(_:)'
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                                                    ^~~~~~~~~~~~~~~~~~~~~~
/Users/christian/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:53: note: use 'withUnsafeMutablePointer' in order to explicitly convert argument to pointer valid for a defined scope
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                                                    ^
/Users/christian/Pecker/Sources/Pecker/PeckerCommand.swift:22:6: error: referencing initializer 'init(name:help:)' on 'Flag' requires the types 'Bool' and 'Int' be equivalent
    @Flag(name: .shortAndLong, help: "Print the version and exit")
     ^
/Users/christian/Pecker/.build/checkouts/swift-argument-parser/Sources/ArgumentParser/Parsable Properties/Flag.swift:273:1: note: where 'Value' = 'Bool'
extension Flag where Value == Int {
^

make: *** [build] Error 1
christian@Christians-MacBook-Pro Pecker % 

Request: Brew support

We use Brew in our CI pipeline to install tools. It would be really useful to be able to install also Pecker through Brew

@IBAction false positive

@IBAction func someFunction() { currently returns a warning, but it is used/called by our UIStoryboard!

False Positive: Test methods in extensions

It looks like test methods declared in extensions currently show warnings as false positives despite the xctest rule being enabled. The following testExample() method shows a warning.

class MyTestClass: XCTestCase {
}

extension MyTestClass {
    func testExample() { // This shows a warning as being unused
        XCTAssertTrue(true)
    }
}

Request: pecker:ignore support for for top-level extensions

Currently it's possible to pecker:ignore classes/structs/enums, but not extensions. For example:

class IgnoreInExtensionExample {

}

// pecker:ignore
extension IgnoreInExtensionExample {
    func unused() {

    }
}

In this example, unused() is still reported as unused, even though the intention was to ignore it. This feature is nice to have because we have a bunch of extensions for base XCTestCase classes.

XCTestCase tests are not ignored

Installed Pecker 0.3.0 with Homebrew and running Pecker as a Run Script Phase in Xcode.
Running with Pecker's defaults and without a yaml file, all my tests show an unused warning.
I tried to add this yaml file:

excluded: # paths to ignore during detecting. Takes precedence over `included`.
- Pods

blacklist_superclass: # all the class inherit from class specified in the list will ignore
- XCTestCase

This succeeded in removing the Cocoapods warnings but I still see all my tests.

My project is part of an Xcode workspace.
It has a few targets (iOS, iOS Tests, Mac, Mac Tests)

执行命令时报错[1] 85594 illegal hardware instruction pecker ./ -i ~/E/Z/Lark-awwlhnagktjjwaendjbfipmvwrcf/Index/DataStore

工程下.pecker.yml文件配置:
reporter: "json"
output_file: "~/Jenkins/workspace/lark/ios/app-analyse/ios-client-master-appsize-verify"

输入命令行pecker ~/Jenkins/workspace/lark/ios/app-analyse/ios-client-master-appsize-verify -i ~/E/Z/Lark-awwlhnagktjjwaendjbfipmvwrcf/Index/DataStore,

报错:[1] 85594 illegal hardware instruction pecker -i ~/E/Z/Lark-awwlhnagktjjwaendjbfipmvwrcf/Index/DataStore

Request: customizable SuperClassRule

We use Quick for testing, which means that our tests inherit from QuickSpec. Since this isn't supported out of the box, it would be nice for us to be able to ignore all subclasses of Quickspec by default.

It seems the best way would be to make the SuperClassRule customizable via .pecker.yml for this.

Request: Better/configurable error output

Hey there! I noticed that the fully build pecker executable, in default configuration, doesn't output any error logs when run. For example, if you run it on a path that doesn't exist, it will swallow the error and not print anything.

It would be really nice to have a better error logging system to provide feedback to users running the executable, since right now the error state and the "no unused code" state look the same.

False Positive - Table View Cells

We have a UITableViewCell class with a corresponding XIB. We register it to the UITableView using tableView.register(nib, reuseIdentifier) and dequeue it as per standard implementation.

As the cell class is not directly referenced, a warning is incorrectly raised.

Failed to compile on macOS 11.5.2 (Intel MacBook Pro)

Installed manually and run make install.

Error message as below

/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:32: warning: initialization of 'UnsafeMutablePointer<yaml_version_directive_t>' (aka 'UnsafeMutablePointer<yaml_version_directive_s>') results in a dangling pointer
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/tieda/Desktop/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:53: note: implicit argument conversion from 'yaml_version_directive_t' (aka 'yaml_version_directive_s') to 'UnsafeMutablePointer<yaml_version_directive_t>' (aka 'UnsafeMutablePointer<yaml_version_directive_s>') produces a pointer valid only for the duration of the call to 'init(_:)'
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                                                    ^~~~~~~~~~~~~~~~~~~~~~
/Users/tieda/Desktop/Pecker/.build/checkouts/Yams/Sources/Yams/Emitter.swift:338:53: note: use 'withUnsafeMutablePointer' in order to explicitly convert argument to pointer valid for a defined scope
            versionDirective = UnsafeMutablePointer(&versionDirectiveValue)
                                                    ^
/Users/tieda/Desktop/Pecker/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:120:46: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
    let textSize = hasCustomText ? Int(cnode.range.length) : 0
                                       ~~~~~ ^~~~~
/Users/tieda/Desktop/Pecker/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:153:35: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
      let startOffset = Int(cnode.range.offset)
                            ~~~~~ ^~~~~
/Users/tieda/Desktop/Pecker/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:157:55: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
      let end = utf8.index(begin, offsetBy: Int(cnode.range.length))
                                                ~~~~~ ^~~~~
/Users/tieda/Desktop/Pecker/.build/checkouts/swift-syntax/Sources/SwiftSyntax/RawSyntax.swift:873:32: error: value of type 'CSyntaxNode' (aka 'swiftparse_syntax_node_t') has no member 'range'
    let byteLength = Int(cnode.range.length)
                         ~~~~~ ^~~~~
/Users/tieda/Desktop/Pecker/.build/checkouts/swift-syntax/Sources/SwiftSyntax/SyntaxParser.swift:195:57: error: missing argument for parameter #3 in call
    let c_top = swiftparse_parse_string(c_parser, source)
                                                        ^
                                                        , <#Int#>
_InternalSwiftSyntaxParser.swiftparse_parse_string:1:13: note: 'swiftparse_parse_string' declared here
public func swiftparse_parse_string(_: swiftparse_parser_t!, _ source: UnsafePointer<CChar>!, _ len: Int) -> swiftparse_client_node_t!
            ^
[101/104] Compiling SwiftSyntax AbsolutePosition.swift
make: *** [build] Error 1

Thanks in advance for looking into this :)

Xcode 14.3 :- phase script execution failed xcode

While moving from xcode 14.2 to 14.3 the build script for packer is failing giving the error as
phase script execution failed xcode
I have the latest cocoapod of 1.12.1
It looks like Pecker is not compatible with Xcode 14.3

False Positive: Subclasses which implement optional protocol methods

Consider the following code:

import Foundation

@objc protocol ProtocolWithOptionalMethods: AnyObject {
    func a()
    @objc optional func b()
}

class Superclass: NSObject, ProtocolWithOptionalMethods {
    func a() {
        print("a")
    }
}

class Subclass: Superclass {
    func b() {
        print("b")
    }
}

Currently, Pecker reports function b() was never used; consider removing it, but b is in fact used as an implementation of the optional method. I put together an example project to demonstrate this here: https://github.com/noahsark769/NGPeckerExamples/blob/master/NGPeckerExamples/OptionalFunctionFromSuperclass.swift#L23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.