Comments (21)
Great idea! I’m going to implement it next week after I study the language a bit.
On 21 Jul 2015, at 3:29 pm, kenji21 [email protected] wrote:
We are using lizard on objc project (thanks you for this nice tool that improve xcode using a simple script), is there any chances that brand new Swift language will be supported ?
I have no idea on how to add support for it, maybe some indication will help to support it.
—
Reply to this email directly or view it on GitHub #61.
from lizard.
Wow, nice :-D
from lizard.
Hi @kenji21 ,
it has been a while. I finally did something with Swift.
I added a new option -l, which can filter the languages:
lizard -lswift <folder_name>
will analyse swift code only, otherwise it will process all file types it knows.
This is only a draft version for Swift support. I’m not sure if it’s completed yet. I don’t know much about Swift myself.
There’s at least one open issue, there seems to be nested functions in Swift,
is it common?
How do you want to count for nested functions?
terry
from lizard.
Hi terry, nice to have some advancement on this.
Unfortunately I haven't switched to fulltime dev using swift yet. So I can't respond to your question.
Maybe having a look at these "swift grammar" files of the tailor project can help : https://github.com/sleekbyte/tailor/tree/master/src/test/swift/com/sleekbyte/tailor/grammar
from lizard.
Thanks!
from lizard.
Cool, it also can find swift and objc issues :
lizard --CCN 12 --ignore_warnings 20 --working_threads 4 -w
./ATvhClient/EPGCollectionViewLayout.swift:12: warning: durationInHourForItemAtIndexPath has 16 CCN and 1 params (71 NLOC, 595 tokens)
./tvheadend-ios-lib/tvheadend-ios-lib/SSHWrapper.m:214: warning: setPortForwardFromPort: toHost: onPort: has 29 CCN and 0 params (134 NLOC, 853 tokens)
from lizard.
There’s also a new option -l to select the language, e.g.
lizard -lswift -lobjc
will only search for swift and objective-c code.
On 16 Dec 2015, at 4:18 PM, kenji21 [email protected] wrote:
Cool, it also can find swift an objc issues :
lizard --CCN 12 --ignore_warnings 20 --working_threads 4 -w
./ATvhClient/EPGCollectionViewLayout.swift:12: warning: durationInHourForItemAtIndexPath has 16 CCN and 1 params (71 NLOC, 595 tokens)
./tvheadend-ios-lib/tvheadend-ios-lib/SSHWrapper.m:214: warning: setPortForwardFromPort: toHost: onPort: has 29 CCN and 0 params (134 NLOC, 853 tokens)
—
Reply to this email directly or view it on GitHub #61 (comment).
from lizard.
Ok, surprising that the EPGCollectionViewLayout.swift:12 is a method of an interface :
protocol EPGCollectionViewLayoutDelegate {
func durationInHourForItemAtIndexPath(indexPath: NSIndexPath) -> Double
func startDateForItemAtIndexPath(indexPath: NSIndexPath) -> NSDate
}
from lizard.
Congrats! you just found a bug! Thanks.
I thought adding Swift shouldn’t be that easy… I will fix it asap.
On 16 Dec 2015, at 4:24 PM, kenji21 [email protected] wrote:
Ok, surprising that the EPGCollectionViewLayout.swift:12 is a method of an interface :
protocol EPGCollectionViewLayoutDelegate {
func durationInHourForItemAtIndexPath(indexPath: NSIndexPath) -> Double
func startDateForItemAtIndexPath(indexPath: NSIndexPath) -> NSDate
}
—
Reply to this email directly or view it on GitHub #61 (comment).
from lizard.
Hi @Jenji21 ,
I just made a new release. It will be great if you can try it at your convenience.
terry
On 16 Dec 2015, at 4:27 PM, Terry [email protected] wrote:
Congrats! you just found a bug! Thanks.
I thought adding Swift shouldn’t be that easy… I will fix it asap.
On 16 Dec 2015, at 4:24 PM, kenji21 <[email protected] mailto:[email protected]> wrote:
Ok, surprising that the EPGCollectionViewLayout.swift:12 is a method of an interface :
protocol EPGCollectionViewLayoutDelegate {
func durationInHourForItemAtIndexPath(indexPath: NSIndexPath) -> Double
func startDateForItemAtIndexPath(indexPath: NSIndexPath) -> NSDate
}
—
Reply to this email directly or view it on GitHub #61 (comment).
from lizard.
Just tried, now it's on the next method of the protocol (edit: which is the last one) :
lizard --CCN 12 --ignore_warnings 20 --working_threads 4 -w
./ATvhClient/EPGCollectionViewLayout.swift:13: warning: startDateForItemAtIndexPath has 16 CCN and 1 params (70 NLOC, 585 tokens)
from lizard.
do you mind send me the file or the context?
On 16 Dec 2015, at 4:45 PM, kenji21 [email protected] wrote:
Just tried, now it's on the next method of the protocol :
lizard --CCN 12 --ignore_warnings 20 --working_threads 4 -w
./ATvhClient/EPGCollectionViewLayout.swift:13: warning: startDateForItemAtIndexPath has 16 CCN and 1 params (70 NLOC, 585 tokens)
—
Reply to this email directly or view it on GitHub #61 (comment).
from lizard.
Sure, this project will be open-sourced soon :-)
EPGCollectionViewLayout.swift.zip
from lizard.
thanks for sharing.
Now the problem is fixed.
from lizard.
Cool, seems to work well on Apple Lister sample:
https://developer.apple.com/library/ios/samplecode/Lister/Introduction/Intro.html
from lizard.
One question @terryyin
the function name is too short so we can't distinguish between functions
from lizard.
@foobra could you also provide the swift code?
from lizard.
https://gist.github.com/foobra/f0a8cc1fcd3ef2081e1b6eb6cbc70e25
lizard -l swift -s cyclomatic_complexity -X demo.swift
from lizard.
@terryyin can we fix that?
from lizard.
from lizard.
Hi @terryyin
How to create the custom file, to override "cyclomatic complexity number". In iOS Swift.
Like mentioned in
-T THRESHOLDS, --Threshold THRESHOLDS
Set the limit for a field. The field can be nloc, cyclomatic_complexity,
token_count, parameter_count, etc. Or an customized file. Lizard will
report warning if a function exceed the limit
from lizard.
Related Issues (20)
- Show CCN only, hide other fields
- lizard --sort cyclomatic_complexity --CCN 10 shows a file with CCN score of 1
- lizard -w --sort cyclomatic_complexity --CCN 10 -H includes all files instead of CCN >10
- Is it accurate to get the result data of fan-in fan-out HOT 1
- lizard gets confused by C++ thousands seperator in hex and binary numbers
- Lizard groups nearly 100 lines into one "function" in a Rust file HOT 4
- Installing lizard using pip doesn't work
- Process error with Objective-C block
- Lizard script doesn't working with jython in springboot applicatoion
- Wrong PARAM count for void type in C/C++
- top_nesting_level stay to 0
- Extension documentation HOT 2
- are there plans to add support for python 3.11 HOT 1
- Not used function_stack property
- Implement argument to set duplicate threshold and add possibility to skip part of file
- Extensions "mjs" and "cjs" do not work HOT 1
- Allow for alternatives to 'GENERATED CODE' to indicate generated files
- Allow for failing cases to be printed to stderr
- Fail brew install on XcodeCloud HOT 2
- duplicate rate and unique rate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lizard.