trackler 2.0.0.4 → 2.0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/clojure/exercises/binary-search/test/binary_search_test.clj +0 -2
- data/tracks/haskell/config.json +6 -0
- data/tracks/haskell/exercises/dominoes/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/dominoes/examples/success-standard/src/Dominoes.hs +15 -0
- data/tracks/haskell/exercises/dominoes/package.yaml +19 -0
- data/tracks/haskell/exercises/dominoes/src/Dominoes.hs +4 -0
- data/tracks/haskell/exercises/dominoes/stack.yaml +1 -0
- data/tracks/haskell/exercises/dominoes/test/Tests.hs +108 -0
- data/tracks/objective-c/Dangerfile +7 -1
- data/tracks/swift/Dangerfile +10 -7
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ad43d193656b92d10fd9344553cf30d66baae72
|
4
|
+
data.tar.gz: fa8601209c89c67e01b4e8d3b797a3fc98271692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad7e2dba3130960687bf8c0dc7b4e0184e4d2951d10090d740af794de761d986e3c88aab193c5678627f9ed9908fe3bfea57c936c694f97c299896bbab2afcda
|
7
|
+
data.tar.gz: b7b933be55c8174b41730383df120ddf5aabd607cf9ef38054ee222df76058d73b8a012249ec1915ce3d529a1d6131469ab7ec684f4c5c0b25fabdc57040babc
|
data/lib/trackler/version.rb
CHANGED
data/tracks/haskell/config.json
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Dominoes (chain) where
|
2
|
+
|
3
|
+
import Data.List (delete)
|
4
|
+
import Data.Maybe (listToMaybe, mapMaybe)
|
5
|
+
|
6
|
+
chain :: [(Int, Int)] -> Maybe [(Int, Int)]
|
7
|
+
chain [] = Just []
|
8
|
+
chain (x@(left, right):xs) = fmap (x:) (subchain xs left right)
|
9
|
+
|
10
|
+
subchain :: [(Int, Int)] -> Int -> Int -> Maybe [(Int, Int)]
|
11
|
+
subchain [] chainLeft chainRight = if chainLeft == chainRight then Just [] else Nothing
|
12
|
+
subchain l chainLeft chainRight = listToMaybe (mapMaybe subchain' l)
|
13
|
+
where subchain' (a, b) | a == chainRight = fmap ((a, b):) (subchain (delete (a, b) l) chainLeft b)
|
14
|
+
subchain' (a, b) | b == chainRight = fmap ((b, a):) (subchain (delete (a, b) l) chainLeft a)
|
15
|
+
subchain' _ = Nothing
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: dominoes
|
2
|
+
|
3
|
+
dependencies:
|
4
|
+
- base
|
5
|
+
|
6
|
+
library:
|
7
|
+
exposed-modules: Dominoes
|
8
|
+
source-dirs: src
|
9
|
+
dependencies:
|
10
|
+
# - foo # List here the packages you
|
11
|
+
# - bar # want to use in your solution.
|
12
|
+
|
13
|
+
tests:
|
14
|
+
test:
|
15
|
+
main: Tests.hs
|
16
|
+
source-dirs: test
|
17
|
+
dependencies:
|
18
|
+
- dominoes
|
19
|
+
- hspec
|
@@ -0,0 +1 @@
|
|
1
|
+
resolver: nightly-2016-07-17
|
@@ -0,0 +1,108 @@
|
|
1
|
+
{-# LANGUAGE FlexibleContexts #-}
|
2
|
+
{-# LANGUAGE RecordWildCards #-}
|
3
|
+
|
4
|
+
import Control.Monad (forM_, unless)
|
5
|
+
import Data.Foldable (for_)
|
6
|
+
import Data.Function (on)
|
7
|
+
import Test.Hspec (Spec, describe, expectationFailure, it, shouldBe, shouldMatchList)
|
8
|
+
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
|
9
|
+
import Text.Printf (printf)
|
10
|
+
|
11
|
+
import Dominoes (chain)
|
12
|
+
|
13
|
+
main :: IO ()
|
14
|
+
main = hspecWith defaultConfig {configFastFail = True} specs
|
15
|
+
|
16
|
+
specs :: Spec
|
17
|
+
specs = describe "dominoes" $
|
18
|
+
describe "chain" $ for_ cases test
|
19
|
+
where
|
20
|
+
|
21
|
+
test Case{..} = it description assertion
|
22
|
+
where
|
23
|
+
assertion = if expected
|
24
|
+
then shouldBeChain $ chain input
|
25
|
+
else chain input `shouldBe` Nothing
|
26
|
+
|
27
|
+
shouldBeChain Nothing = expectationFailure "should have had a chain, but didn't"
|
28
|
+
shouldBeChain (Just output) = do
|
29
|
+
output `shouldMatchDominoesOf` input
|
30
|
+
consecutivesShouldMatch output
|
31
|
+
endsShouldMatch output
|
32
|
+
|
33
|
+
shouldMatchDominoesOf = shouldMatchList `on` map sortDomino
|
34
|
+
|
35
|
+
consecutivesShouldMatch l = forM_ (indexedPairs l) $ \(d1, d2, i) ->
|
36
|
+
shouldBeConsecutive l ("domino " ++ show i, d1) ("domino " ++ show (i + 1), d2)
|
37
|
+
|
38
|
+
endsShouldMatch [] = return ()
|
39
|
+
endsShouldMatch l@(d1:_) =
|
40
|
+
shouldBeConsecutive l (" last domino", last l) ("first domino", d1)
|
41
|
+
|
42
|
+
indexedPairs :: [a] -> [(a, a, Int)]
|
43
|
+
indexedPairs l = zip3 l (drop 1 l) [1..]
|
44
|
+
|
45
|
+
sortDomino (a, b) = if a > b then (b, a) else (a, b)
|
46
|
+
|
47
|
+
shouldBeConsecutive l (name1, d1@(_, d1r)) (name2, d2@(d2l, _)) =
|
48
|
+
unless (d1r == d2l) $
|
49
|
+
expectationFailure $
|
50
|
+
printf "In chain %s:\n\t right end of %s (%s)\n\tand left end of %s (%s)\n\tdidn't match!" (show l) name1 (show d1) name2 (show d2)
|
51
|
+
|
52
|
+
-- Test cases adapted from `exercism/x-common/dominoes` on 2016-11-11.
|
53
|
+
|
54
|
+
data Case = Case { description :: String
|
55
|
+
, input :: [(Int, Int)]
|
56
|
+
, expected :: Bool
|
57
|
+
}
|
58
|
+
|
59
|
+
cases :: [Case]
|
60
|
+
cases = [ Case { description = "empty input = empty output"
|
61
|
+
, input = []
|
62
|
+
, expected = True
|
63
|
+
}
|
64
|
+
, Case { description = "singleton input = singleton output"
|
65
|
+
, input = [(1, 1)]
|
66
|
+
, expected = True
|
67
|
+
}
|
68
|
+
, Case { description = "singleton that can't be chained"
|
69
|
+
, input = [(1, 2)]
|
70
|
+
, expected = False
|
71
|
+
}
|
72
|
+
, Case { description = "three elements"
|
73
|
+
, input = [(1, 2), (3, 1), (2, 3)]
|
74
|
+
, expected = True
|
75
|
+
}
|
76
|
+
, Case { description = "can reverse dominoes"
|
77
|
+
, input = [(1, 2), (1, 3), (2, 3)]
|
78
|
+
, expected = True
|
79
|
+
}
|
80
|
+
, Case { description = "can't be chained"
|
81
|
+
, input = [(1, 2), (4, 1), (2, 3)]
|
82
|
+
, expected = False
|
83
|
+
}
|
84
|
+
, Case { description = "disconnected - simple"
|
85
|
+
, input = [(1, 1), (2, 2)]
|
86
|
+
, expected = False
|
87
|
+
}
|
88
|
+
, Case { description = "disconnected - double loop"
|
89
|
+
, input = [(1, 2), (2, 1), (3, 4), (4, 3)]
|
90
|
+
, expected = False
|
91
|
+
}
|
92
|
+
, Case { description = "disconnected - single isolated"
|
93
|
+
, input = [(1, 2), (2, 3), (3, 1), (4, 4)]
|
94
|
+
, expected = False
|
95
|
+
}
|
96
|
+
, Case { description = "need backtrack"
|
97
|
+
, input = [(1, 2), (2, 3), (3, 1), (2, 4), (2, 4)]
|
98
|
+
, expected = True
|
99
|
+
}
|
100
|
+
, Case { description = "separate loops"
|
101
|
+
, input = [(1, 2), (2, 3), (3, 1), (1, 1), (2, 2), (3, 3)]
|
102
|
+
, expected = True
|
103
|
+
}
|
104
|
+
, Case { description = "ten elements"
|
105
|
+
, input = [(1, 2), (5, 3), (3, 1), (1, 2), (2, 4), (1, 6), (2, 3), (3, 4), (5, 6)]
|
106
|
+
, expected = True
|
107
|
+
}
|
108
|
+
]
|
@@ -5,7 +5,13 @@ if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}
|
|
5
5
|
fail('Please rebase to get rid of the merge commits in this PR')
|
6
6
|
end
|
7
7
|
can_merge = github.pr_json["mergeable"]
|
8
|
-
|
8
|
+
is_merged = github.pr_json["merged"]
|
9
|
+
|
10
|
+
if is_merged
|
11
|
+
warn("This PR was merged before CI was done.", sticky: false)
|
12
|
+
else
|
13
|
+
warn("This PR cannot be merged yet.", sticky: false) unless can_merge
|
14
|
+
end
|
9
15
|
|
10
16
|
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
|
11
17
|
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
|
data/tracks/swift/Dangerfile
CHANGED
@@ -5,7 +5,13 @@ if git.commits.any? { |c| c.message =~ /^Merge branch '#{github.branch_for_base}
|
|
5
5
|
fail('Please rebase to get rid of the merge commits in this PR')
|
6
6
|
end
|
7
7
|
can_merge = github.pr_json["mergeable"]
|
8
|
-
|
8
|
+
is_merged = github.pr_json["merged"]
|
9
|
+
|
10
|
+
if is_merged
|
11
|
+
warn("This PR was merged before CI was done.", sticky: false)
|
12
|
+
else
|
13
|
+
warn("This PR cannot be merged yet.", sticky: false) unless can_merge
|
14
|
+
end
|
9
15
|
|
10
16
|
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
|
11
17
|
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"
|
@@ -20,9 +26,9 @@ warn("Please provide a summary in the Pull Request description") if github.pr_bo
|
|
20
26
|
jsonpath = "lintreport.json"
|
21
27
|
contents = File.read jsonpath
|
22
28
|
require "json"
|
23
|
-
if contents.to_s == ''
|
29
|
+
if contents.to_s == ''
|
24
30
|
contents = "[]"
|
25
|
-
end
|
31
|
+
end
|
26
32
|
json = JSON.parse contents
|
27
33
|
json.each do |object|
|
28
34
|
shortFile = object["file"]
|
@@ -30,7 +36,7 @@ json.each do |object|
|
|
30
36
|
shortFile = shortFile.to_s || ''
|
31
37
|
msg = object["reason"].to_s || ''
|
32
38
|
line = object["line"] || 1
|
33
|
-
#only warn for files that were edited in this PR.
|
39
|
+
#only warn for files that were edited in this PR.
|
34
40
|
if git.modified_files.include? shortFile
|
35
41
|
shortFile.prepend("/") # get away from doing inline comments since they are buggy as of Sep-2016
|
36
42
|
warn(msg, file: shortFile, line: line)
|
@@ -45,6 +51,3 @@ contents2 = File.read jsonpath2
|
|
45
51
|
json2 = JSON.parse contents2
|
46
52
|
firstStrinInArray = json2["tests_summary_messages"][0]
|
47
53
|
message(firstStrinInArray)
|
48
|
-
|
49
|
-
|
50
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -2907,6 +2907,12 @@ files:
|
|
2907
2907
|
- tracks/haskell/exercises/difference-of-squares/src/Squares.hs
|
2908
2908
|
- tracks/haskell/exercises/difference-of-squares/stack.yaml
|
2909
2909
|
- tracks/haskell/exercises/difference-of-squares/test/Tests.hs
|
2910
|
+
- tracks/haskell/exercises/dominoes/examples/success-standard/package.yaml
|
2911
|
+
- tracks/haskell/exercises/dominoes/examples/success-standard/src/Dominoes.hs
|
2912
|
+
- tracks/haskell/exercises/dominoes/package.yaml
|
2913
|
+
- tracks/haskell/exercises/dominoes/src/Dominoes.hs
|
2914
|
+
- tracks/haskell/exercises/dominoes/stack.yaml
|
2915
|
+
- tracks/haskell/exercises/dominoes/test/Tests.hs
|
2910
2916
|
- tracks/haskell/exercises/etl/examples/success-standard/package.yaml
|
2911
2917
|
- tracks/haskell/exercises/etl/examples/success-standard/src/ETL.hs
|
2912
2918
|
- tracks/haskell/exercises/etl/package.yaml
|