1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00
Commit Graph

299 Commits

Author SHA1 Message Date
Timothy Clem
0aab5ebd55 Replace supportedExts 2019-08-15 15:48:17 -07:00
Patrick Thomson
b17a2c0ee8 Better nomenclature. 2019-06-19 17:56:37 -04:00
Patrick Thomson
4de36c5f0e Rewrite the Stat tests so they're not racy. 2019-06-19 17:54:53 -04:00
Patrick Thomson
43e3fb4533 Remove unnecessary use of parallel. 2019-06-19 17:22:09 -04:00
Jan Hrček
ec4248cbb4 Fix warnings in tests
27 [-Wunused-matches]
 7 [-Wmissing-export-lists]
 6 [-Wunused-imports]
 5 [-Wmissing-signatures]
 2 [-Wincomplete-uni-patterns]
 1 [-Wunused-top-binds]
 1 [-Wtype-defaults]
2019-06-15 08:56:59 +02:00
Patrick Thomson
e1d94f07d1 Remove Listable instance for Source.
This was created with a whole mess of Leancheck combinators. A
Hedgehog approach makes things easier.
2019-06-14 11:53:42 -04:00
Patrick Thomson
bfdb4a1de7 Clean up specs with some implicit parameters.
Test cases are a good use of `-XImplicitParams`, because often one
finds oneself plumbing a bunch of parameters obtained from IO through
a dozen layers of pure functions. Implicit parameters make this sort
of passing significantly easier.

Fixes #128.
2019-06-12 13:55:14 -04:00
Patrick Thomson
7d88f930cb Fix sentence fragment. 2019-06-12 13:27:34 -04:00
Patrick Thomson
6a15695195 Even more unused imports. 2019-06-12 13:16:34 -04:00
Patrick Thomson
acbacbe779 Use golden tests for the CLI. 2019-06-12 12:26:37 -04:00
Patrick Thomson
99c4bb21f8 Overhaul test harnesses and add tasty bounds. 2019-06-12 11:30:20 -04:00
Max Brunsfeld
3c0dd6cc45 Add unit test for parsing with a timeout
Co-Authored-By: Rick Winfrey <rewinfrey@github.com>
2019-03-19 11:56:07 -07:00
Rick Winfrey
9813ae2319 Parameterize TaskSession with isPublic 2019-02-15 16:22:51 -08:00
Timothy Clem
50bedeb689 Remove extraneous proto encoding/decode from our internal datatypes 2019-02-06 14:55:43 -08:00
Timothy Clem
ce04fa8f12 Refactor runTask 2019-02-01 15:04:23 -08:00
Rick Winfrey
e7c984182c Update specs 2019-01-18 18:21:24 -08:00
Patrick Thomson
e329cbe89a unify the last spec 2018-12-11 17:36:42 -05:00
Patrick Thomson
1de0e9ef09 move specs around 2018-12-11 17:21:39 -05:00
joshvera
073dca372d Remove Data.Abstract.Environment 2018-12-05 10:20:35 -05:00
Timothy Clem
343289f1c5 Merge remote-tracking branch 'origin/master' into docstrings-round2 2018-11-06 09:17:49 -08:00
Patrick Thomson
7ea52dbfe3 Give Control.Matching API better ergonomics.
Given that @tclem and I have found the matcher API frustrating, I've
taken a stab at improving its ergonomics, and I've found some success
in separating composition of matchers from predicate-based narrowing
thereof.

The biggest change here is the elimination of the old `match`
combinator, which proved to be clumsy in that it complected narrowing
and composition. Top-down matching combinators are now written with
the `need` combinator and the `>>>` combinator, which is more readable
and more versatile. Here's a matcher that accepts functions with
Python docstrings:

```haskell
docstringMatcher :: ( Decl.Function :< fs
                    , [] :< fs
                    , Lit.TextElement :< fs
                    , term ~ Term (Sum fs) ann
                    ) => Matcher term term
docstringMatcher = target <*
               (need Decl.functionBody
                >>> narrow @[]
                >>> mhead
                >>> narrow @Lit.TextElement
                >>> ensure Lit.isTripleQuoted))
```

Pretty readable, right? Each step of the tree regular expression -
choosing function bodies, ensuring said bodies are lists, examining
the first element, and choosing only TextElements containing
triple-quoted strings - is made implicit. The old way would have
looked something like this:

```haskell
docstringMatcher = target <* match Decl.functionBody
                           $ narrow
                           $ matchM listToMaybe
                           $ target <* ensure Lit.isTripleQuoted
```
which is a good deal more disorganized and less flexible
in the quite-common case of applying functions during a
matching pass. Separating the act of composition from
function application is a big win here.

Further comments are inline.
2018-11-02 19:25:29 -04:00
Timothy Clem
0f56f33f24 Introduce some symbol/tags tests 2018-11-02 13:55:30 -07:00
Patrick Thomson
b9cf8f73c6 Environment and App. 2018-10-31 15:47:30 -04:00
Patrick Thomson
d473b9e1af add Data/Abstract/Name/Spec 2018-10-31 13:19:43 -04:00
Patrick Thomson
b0e6190dbf add Data/Range/Spec 2018-10-31 12:46:52 -04:00
Patrick Thomson
cd05aaa7a5 add Data/Graph/Spec 2018-10-31 12:30:56 -04:00
Patrick Thomson
d1cc400dc0 add spec file 2018-09-14 13:10:22 -04:00
Patrick Thomson
dccea555ed Extremely ad-hoc renderer to Docs 2018-07-31 12:44:20 -04:00
Patrick Thomson
6823fb92b6 better module name 2018-07-31 10:43:46 -04:00
Patrick Thomson
a61fe301c4 Skeleton and initial test case 2018-07-30 16:00:09 -04:00
Patrick Thomson
0ed48c7bbe Simplest test possible. 2018-07-16 11:07:40 -04:00
Rob Rix
7e2f7614f7 Fix up the imports. 2018-07-10 14:17:56 -04:00
Rob Rix
1e6a3f71e2 Use withOptions in the spec. 2018-07-10 14:16:51 -04:00
Rob Rix
40d46e921d Pass the configuration to the analysis specs. 2018-07-10 14:09:22 -04:00
Rob Rix
255a0aa62b Move TaskConfig into Semantic.Util. 2018-07-10 14:09:02 -04:00
Rob Rix
b33daf0ce1 Pass the task config stuff around as a single datum. 2018-07-10 13:49:34 -04:00
Rob Rix
90cb86d027 Pass config & queues to the integration specs. 2018-07-09 14:26:15 -04:00
Patrick Thomson
f9f0dd5e79 Use a hand-written integer parser.
Rather than relying on the `Read` instance for `Integer`, let's make
our assumptions about the format explicit. This was mostly a matter of
extracting internal functions from the `Scientific` parser.
2018-06-25 11:55:32 -04:00
Patrick Thomson
fbff61b247 actually run the specs 2018-06-05 12:51:23 -04:00
Rob Rix
54150552b3 Merge branch 'master' into 🔥-galign 2018-05-29 08:53:37 -04:00
Rob Rix
c427be3670 Stub in a spec for Evaluator. 2018-05-07 14:21:05 -04:00
Timothy Clem
95b7fd5888 Resolve module import paths that walk up directory structure (e.g. ../) 2018-04-17 14:13:01 -07:00
Rob Rix
d863d282b1 🔥 the Mergeable spec. 2018-04-09 16:38:28 -04:00
Patrick Thomson
faf246ff1e Merge remote-tracking branch 'origin/master' into fix-scientific-parsing 2018-04-04 15:40:51 -04:00
Patrick Thomson
c36256e943 Standardize and fix floating-point parsing.
The existence of #1705 showed me that it's time to remove the bandaid
of a fix that was `normalizeFloatString` in #1537. This patch
introduces a proper Attoparsec parser for Scientific values that
handles the vaguaries of cross-language floating-point syntax. We
already depended on Attoparsec indirectly, so adding it as an explicit
dependency is fine.

A unit test is included, with examples taken from the tree-sitter corpora.
2018-04-03 17:02:56 -04:00
Timothy Clem
208d16e131 Disable import-graph specs for now 2018-04-03 10:12:20 -07:00
Patrick Thomson
034bb562d4 Introduce tree-automata DSL for filtering and matching ASTs.
This patch adds the `Matcher` monad, which is capable of filtering any
recursive data structure, bottom-up, yielding a list of (or an
optional) result. These functions are probably going to be used over
`Term` values, so API is provided to wrap common projection functions.

The API was more or less copied directly from that of Clang's AST
matching facilities.

There are a lot of things we can do in the future:
* Binding results yielded in matchers to associated names, for future
  transformation stages to look up and modify.
* Actual transformation stages.
* Optimizations. This is not very fast.

A million thanks to @robrix, whose sage advice managed to turn my
kooky idea for an API into something really special and exciting.
2018-03-27 16:14:30 -04:00
Timothy Clem
7fdc5e2fda Write a small spec for evaluating PHP includes 2018-03-19 14:42:31 -07:00
Timothy Clem
1e276dddef TDD FTW 2018-03-15 11:34:34 -07:00
Timothy Clem
579a447961 Test out go import evaling 2018-03-13 11:14:55 -07:00