Skip to content

Commit

Permalink
move sgrep to subdirectory, pin pfff as git submodule (semgrep#258)
Browse files Browse the repository at this point in the history
* move sgrep to subdirectory, pin pfff as git submodule
  • Loading branch information
ievans authored Mar 6, 2020
1 parent 1fed634 commit 01bac59
Show file tree
Hide file tree
Showing 460 changed files with 54 additions and 20 deletions.
19 changes: 7 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ jobs:
executor: sgrep-build
steps:
- checkout
- run: cd ~ && git clone https://github.com/returntocorp/pfff
- run: eval $(opam env) && cd ~/pfff && ./configure && make depend && make && make opt && make install-libs
- run: eval $(opam env); make all
- run: cd sgrep_lint; make all
- persist_to_workspace:
root: /home/opam/project
paths:
- _build
- run: git submodule init && git submodule update --remote
- run: eval $(opam env) && cd ./pfff && ./configure && make depend && make && make opt && make install-libs
- run: eval $(opam env) && cd sgrep && make all
build-lint:
executor: sgrep-build
steps:
Expand All @@ -27,14 +22,14 @@ jobs:
executor: sgrep-build
steps:
- checkout
- run: git submodule init && git submodule update --remote
- attach_workspace:
at: /home/opam/project
- run: pip3 install -r sgrep_lint/requirements.txt
- run: ln -s /home/opam/project/_build/default/bin/main_sgrep.exe /home/opam/.local/bin/sgrep
- run: cd ~ && git clone https://github.com/returntocorp/pfff # TODO remove and just mount these two lines
- run: eval $(opam env) && cd ~/pfff && ./configure && make depend && make && make opt && make install-libs
- run: eval $(opam env); make test
- run: cd sgrep_lint && make test
- run: eval $(opam env) && cd ./pfff && ./configure && make depend && make && make opt && make install-libs
- run: eval $(opam env) && cd sgrep && make test && make && make install
- run: eval $(opam env) && cd sgrep_lint && make test


workflows:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pfff"]
path = pfff
url = [email protected]:returntocorp/pfff.git
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ WORKDIR /home/opam/

COPY --chown=opam . /home/opam/sgrep/

RUN git clone https://github.com/returntocorp/pfff
RUN eval $(opam env) && cd pfff && ./configure && make depend && make && make opt && make install-libs

RUN eval $(opam env); cd sgrep; make all
RUN eval $(opam env) && cd sgrep/pfff && ./configure && make depend && make && make opt && make install-libs
RUN eval $(opam env) && cd sgrep; make all
RUN /home/opam/sgrep/_build/default/bin/main_sgrep.exe -version

## sgrep lint build
Expand Down
9 changes: 6 additions & 3 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ be yet in the latest OPAM version of pfff. In that case, install pfff
manually by doing:

```bash
git clone https://github.com/returntocorp/pfff
git submodule init && git submodule update --remote
cd pfff
./configure; make depend; make; make opt; make reinstall-libs
```

Then you can compile the program with:

```bash
cd sgrep
dune build
```

Expand All @@ -58,15 +59,17 @@ Then to test sgrep on a file, for example tests/GENERIC/test.py
run:

```bash
cd sgrep
./_build/default/bin/main_sgrep.exe -e foo tests/python
...
```

If you want to test sgrep on a directory with a set of given rules, run:

```bash
cp ./_build/default/bin/main_sgrep.exe /usr/local/bin/sgrep
cp ./sgrep.py /usr/local/bin/sgrep-lint
cp ./sgrep/_build/default/bin/main_sgrep.exe /usr/local/bin/sgrep
cd sgrep_lint
make && make install
sgrep-lint --config <YAML_FILE_OR_DIRECTORY> <code to check>
```

Expand Down
1 change: 1 addition & 0 deletions pfff
Submodule pfff added at d33746
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions sgrep/tests/js/misc_id_vs_name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//ERROR: match
var foo = "bar";
console.log(foo);

function test() {
//ERROR: match
var foo2 = "bar";
console.log(foo2);
}
2 changes: 2 additions & 0 deletions sgrep/tests/js/misc_id_vs_name.sgrep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var $X = ...;
console.log($X);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 01bac59

Please sign in to comment.