Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzablocki committed Jan 2, 2017
0 parents commit dec6a93
Show file tree
Hide file tree
Showing 239 changed files with 21,354 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
ignore:
- Example/.*
status:
patch: false
changes: false
project:
default:
target: 70
comment: false
65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing to Traits

Traits is an open source project started by Krzysztof Zabłocki at The New York Times and open to the entire Cocoa community.

We really appreciate your help!

## Filing issues

When filing an issue, make sure to answer these five questions:

1. What version of Swift are you using (`swift --version`)?
2. What did you do?
3. What did you expect to see?
4. What did you see instead?

## Contributing code

Before submitting changes, please follow these guidelines:

1. Check the open issues and pull requests for existing discussions.
2. Open an issue to discuss a new feature.
3. Write tests.
4. Make sure your changes pass `make test`.
5. Make sure the entire test suite passes locally and on Travis CI.
6. Open a Pull Request.

Unless otherwise noted, the Traits source files are distributed under
the MIT license found in the LICENSE.md file.

[Please review our Code of Conduct](https://github.com/NYTimes/Traits/blob/master/CODE_OF_CONDUCT.md)
54 changes: 54 additions & 0 deletions Example/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
disabled_rules: # rule identifiers to exclude from running
- function_parameter_count
- line_length
- variable_name
- cyclomatic_complexity
- nesting
- conditional_binding_cascade
- force_cast

opt_in_rules: # some rules are only opt-in
- force_unwrapping
- force_https
- empty_count
- conditional_binding_cascade

excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- Packages

included:
../Traits

type_body_length:
- 700 #warning
- 1000 #error

file_length:
- 1000 #warning
- 1200 #error

function_body_length:
- 125 #warning
- 200 #error

type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 50
error: 50

custom_rules:
force_https:
name: "Force HTTPS over HTTP"
regex: "((?i)http(?!s))"
match_kinds: string
message: "HTTPS should be favored over HTTP"
severity: warning

explicit_failure_calls:
name: "Avoid asserting 'false'"
regex: "((assert|precondition)\(false)"
message: "Use assertionFailure() or preconditionFailure() instead."
severity: warning
Empty file added Example/0.1.0
Empty file.
47 changes: 47 additions & 0 deletions Example/Generated.TraitIdentifiers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import Traits

enum TraitIdentifier {
case containerView
case backgroundView
case titleLabel
case childView
case childViewWidth
case childViewHeight
case titleLabelLeading
case titleLabelTop

private var entry: TraitIdentifierEntry {
switch self {
case .containerView:
return TraitIdentifierEntry("containerView", classes: [UIView.self])
case .backgroundView:
return TraitIdentifierEntry("backgroundView", classes: [UIView.self])
case .titleLabel:
return TraitIdentifierEntry("titleLabel", classes: [UILabel.self])
case .childView:
return TraitIdentifierEntry("childView", classes: [UIView.self])
case .childViewWidth:
return TraitIdentifierEntry("childView.width", classes: [NSLayoutConstraint.self])
case .childViewHeight:
return TraitIdentifierEntry("childView.height", classes: [NSLayoutConstraint.self])
case .titleLabelLeading:
return TraitIdentifierEntry("titleLabel.leading", classes: [NSLayoutConstraint.self])
case .titleLabelTop:
return TraitIdentifierEntry("titleLabel.top", classes: [NSLayoutConstraint.self])
}
}

var identifier: String { return self.entry.identifier }
}

extension TraitsProvider.Specification {
init(typedSpec: [TraitIdentifier: [Trait]]) {
var dict = [String: [Trait]]()

_ = typedSpec.map { identifier, list in
dict[identifier.identifier] = list
}

self.init(specs: dict)
}
}
12 changes: 12 additions & 0 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use_frameworks!

target 'Traits_Example' do
pod 'Traits', :path => '../'

target 'Traits_Tests' do
inherit! :search_paths

pod 'Quick'
pod 'Nimble'
end
end
28 changes: 28 additions & 0 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
PODS:
- KZFileWatchers (1.0.1)
- Nimble (5.1.1)
- ObjectMapper (2.2.2)
- Quick (1.0.0)
- Traits (0.1.0):
- KZFileWatchers
- ObjectMapper

DEPENDENCIES:
- Nimble
- Quick
- Traits (from `../`)

EXTERNAL SOURCES:
Traits:
:path: "../"

SPEC CHECKSUMS:
KZFileWatchers: 0215a3745b1822c5efb56562b5870153dee582d0
Nimble: 415e3aa3267e7bc2c96b05fa814ddea7bb686a29
ObjectMapper: 9e385c2295bcc4e16eabbcfc85db801442bba545
Quick: 8024e4a47e6cc03a9d5245ef0948264fc6d27cff
Traits: 30a8b6a2a1477038d985ec1eed7f1986f16aad11

PODFILE CHECKSUM: d519fe72cc8bf70fb02631c44d209de7c32afdac

COCOAPODS: 1.2.0.beta.1
Loading

0 comments on commit dec6a93

Please sign in to comment.