[LIGO-25] Chores (add Makefile, scripts, vendor, stylish)
Problem: We need to add stylish config to settle code style for our project. Makefile to simplify its building. Also we need to check our project for trailing whitespaces so we need to add the corresponding script to be used later in CI. Solution: Add - stylish-haskell config - Makefile - `check_trailing_whitespace` script
This commit is contained in:
parent
99321a59bb
commit
820d73f345
@ -20,8 +20,8 @@ Right now only one parser is linked there; the name of symlink should be changed
|
||||
in future.
|
||||
|
||||
Server part invokes the TS-parser and then constructs a tree of haskell datatypes
|
||||
from the TS-tree. Then it is fed into `AST.Parser` (name will be changed), which
|
||||
constructs an universal AST from the tree of the respective language.
|
||||
from the TS-tree. Then it is fed into `LIGO.Parser` (name will be changed), which
|
||||
constructs an universal LIGO from the tree of the respective language.
|
||||
|
||||
Parser uses the root `Parser` module which provides the combinators and monad
|
||||
to deal with `ParseTree`, produced from TS output.
|
||||
|
66
tools/lsp/squirrel/.stylish-haskell.yaml
Normal file
66
tools/lsp/squirrel/.stylish-haskell.yaml
Normal file
@ -0,0 +1,66 @@
|
||||
# SPDX-FileCopyrightText: 2019 Serokell <https://serokell.io>
|
||||
#
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
|
||||
# Default stylish-haskell config used in Serokell.
|
||||
|
||||
steps:
|
||||
- simple_align:
|
||||
cases: false
|
||||
top_level_patterns: false
|
||||
records: false
|
||||
- imports:
|
||||
align: none
|
||||
list_align: after_alias
|
||||
pad_module_names: false
|
||||
long_list_align: new_line
|
||||
empty_list_align: inherit
|
||||
list_padding: 2
|
||||
separate_lists: true
|
||||
space_surround: false
|
||||
- language_pragmas:
|
||||
style: compact
|
||||
remove_redundant: true
|
||||
- trailing_whitespace: {}
|
||||
columns: 100
|
||||
newline: native
|
||||
language_extensions:
|
||||
- BangPatterns
|
||||
- BlockArguments
|
||||
- ConstraintKinds
|
||||
- DataKinds
|
||||
- DefaultSignatures
|
||||
- DeriveAnyClass
|
||||
- DeriveDataTypeable
|
||||
- DeriveGeneric
|
||||
- DerivingStrategies
|
||||
- DerivingVia
|
||||
- EmptyCase
|
||||
- ExistentialQuantification
|
||||
- ExplicitNamespaces
|
||||
- FlexibleContexts
|
||||
- FlexibleInstances
|
||||
- FunctionalDependencies
|
||||
- GADTs
|
||||
- GeneralizedNewtypeDeriving
|
||||
- LambdaCase
|
||||
- MultiParamTypeClasses
|
||||
- MultiWayIf
|
||||
- NamedFieldPuns
|
||||
- NoImplicitPrelude
|
||||
- OverloadedLabels
|
||||
- OverloadedStrings
|
||||
- PatternSynonyms
|
||||
- RebindableSyntax
|
||||
- RecordWildCards
|
||||
- RecursiveDo
|
||||
- ScopedTypeVariables
|
||||
- StandaloneDeriving
|
||||
- TemplateHaskell
|
||||
- TemplateHaskellQuotes
|
||||
- TupleSections
|
||||
- TypeApplications
|
||||
- TypeFamilies
|
||||
- TypeOperators
|
||||
- ViewPatterns
|
||||
- QuasiQuotes
|
30
tools/lsp/squirrel/Makefile
Normal file
30
tools/lsp/squirrel/Makefile
Normal file
@ -0,0 +1,30 @@
|
||||
SITTER ?= tree-sitter
|
||||
|
||||
DIRS := grammar/pascaligo grammar/reasonligo grammar/camligo
|
||||
|
||||
PACKAGE := squirrel
|
||||
|
||||
STACK_DEV_OPTIONS = --fast --ghc-options -Wwarn --file-watch
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
all: build
|
||||
|
||||
FORCE:
|
||||
|
||||
generate: $(DIRS)
|
||||
|
||||
$(DIRS): FORCE
|
||||
# $(SITTER) generate # Generation is manual for now
|
||||
mkdir -p $(PACKAGE)/vendor/$@
|
||||
cp $@/src/parser.c vendor/$@/parser.c
|
||||
cp -r $@/src/tree_sitter vendor/$@/tree_sitter
|
||||
|
||||
clean:
|
||||
$(RM) vendor/*
|
||||
stack clean
|
||||
|
||||
build:
|
||||
stack build $(STACK_DEV_OPTIONS)
|
||||
|
||||
.PHONY: all clean generate build FORCE
|
@ -57,10 +57,12 @@ library:
|
||||
- src/
|
||||
|
||||
include-dirs:
|
||||
- vendor
|
||||
- vendor/pascaligo
|
||||
- vendor/reasonligo
|
||||
|
||||
c-sources:
|
||||
- vendor/parser.c
|
||||
- vendor/pascaligo/parser.c
|
||||
- vendor/reasonligo/parser.c
|
||||
|
||||
executables:
|
||||
squirrel:
|
||||
@ -77,4 +79,6 @@ executables:
|
||||
source-dirs:
|
||||
- app/
|
||||
|
||||
ghc-options: -threaded
|
||||
ghc-options:
|
||||
- -threaded
|
||||
- -Wall
|
||||
|
14
tools/lsp/squirrel/scripts/check-trailing-whitespace.sh
Executable file
14
tools/lsp/squirrel/scripts/check-trailing-whitespace.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2020 Tocqueville Group
|
||||
#
|
||||
# SPDX-License-Identifier: LicenseRef-MIT-TQ
|
||||
|
||||
files=$(git ls-files | xargs grep --files-with-matches --binary-files=without-match '[[:blank:]]$')
|
||||
if [[ -n $files ]];then
|
||||
echo ' Files with trailing whitespace found:'
|
||||
for f in "${files[@]}"; do
|
||||
echo " * $f"
|
||||
done
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user