Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for C# static analysis #584

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
eb2a364
csharp plugin added
Borisz42 Feb 1, 2022
48d98ee
gitignore update
Borisz42 Feb 1, 2022
8127a2c
gitignore update2
Borisz42 Feb 1, 2022
c831e8f
csharp parse from cmd path param
Borisz42 Feb 8, 2022
e0e9c0d
testing boost
Borisz42 Feb 12, 2022
de199d2
cmake buildable
Borisz42 Feb 17, 2022
67f89af
return added at parseCompileCommands_dir
Borisz42 Feb 17, 2022
a347422
proper build and run from install directory
Borisz42 Feb 19, 2022
b8ff653
Parametric connection-string
Borisz42 Feb 20, 2022
77bc130
commandline arguments fix
Borisz42 Feb 22, 2022
74ff887
assemblies added in csharp
Borisz42 Mar 2, 2022
5a2ad78
linq variable detection
Borisz42 Mar 3, 2022
be518ed
database create bug solved
Borisz42 Mar 5, 2022
4d7d85e
js files
Borisz42 Mar 8, 2022
86db562
Merge branch 'master' into csharp_plugin
Borisz42 Mar 8, 2022
3e858dc
Thrift csharp lib added, csharp service init
Borisz42 Mar 16, 2022
9bc4a03
csharpMenu gtag update
Borisz42 Mar 16, 2022
addff01
Unimplemented methods added to csharp service
Borisz42 Mar 16, 2022
c1e078c
Csharp service updates to run a succesfull build
Borisz42 Mar 16, 2022
caf19bb
parser addSource problem
Borisz42 Mar 25, 2022
1c9f41e
parser linking problem solved
Borisz42 Mar 27, 2022
6171a93
csharp astnode-id generator
Borisz42 Apr 20, 2022
33720f9
Added base of the service with some fixes in the parser.
intjftw Apr 25, 2022
a906af0
csharpservice boost start
Borisz42 Apr 25, 2022
9ebdb06
bulid and json parse error fix
Borisz42 Apr 27, 2022
018f49c
service debug
Borisz42 Apr 27, 2022
d80b6b2
file type property set
Borisz42 Apr 29, 2022
63f274a
Info Tree basics working
Borisz42 May 1, 2022
d600a48
refactor and getPropertiesAsync
Borisz42 May 4, 2022
833d8a1
position bug solved
Borisz42 May 5, 2022
c4c6d0d
parallel parsing
Borisz42 May 8, 2022
1b853e0
testing and minor fixes
Borisz42 May 9, 2022
218725f
show variable usage and declaration
Borisz42 May 12, 2022
b7f5068
usage fix
Borisz42 May 13, 2022
6cf6325
Display linq evaluation
Borisz42 May 13, 2022
99d6fe6
LINQ foreach added
Borisz42 May 13, 2022
5c206c7
IdentifierName visitor added
Borisz42 May 14, 2022
4463b32
missing try catch added
Borisz42 May 14, 2022
57b674c
references fileId instead of path in AstnodeInfos
Borisz42 May 15, 2022
c84a770
usage fix
Borisz42 May 15, 2022
55c8c43
reference queries
Borisz42 May 15, 2022
fb9cea0
visibility added
Borisz42 May 15, 2022
d3fcba5
speed up by less backgroundlogging
Borisz42 May 15, 2022
807b806
Minor fixes
Borisz42 May 15, 2022
1fecdf0
"Jump to definition" is working in the inner menu. Added ReferenceTyp…
intjftw May 16, 2022
b28a733
Refactored database initialization to use context options and migrati…
intjftw May 18, 2022
fc12e6a
Updated the GitHub Actions CI file.
intjftw May 18, 2022
5cdb276
Merge branch 'csharp_plugin' of github.com:intjftw/CodeCompass into c…
Borisz42 May 20, 2022
268dbab
Adding migrations.
intjftw May 20, 2022
73f6b38
Merge branch 'csharp_plugin' of github.com:intjftw/CodeCompass into c…
intjftw May 20, 2022
60dc5d1
Updating project versions to .NET, updating all nuget packages and re…
intjftw May 23, 2022
22894c9
Updating Dockerfiles to include .NET 6.
intjftw May 23, 2022
77e28b3
Merge branch 'master' into csharp_plugin
intjftw Oct 4, 2022
d15bcbf
Making C# web service able to serve more than one project in a worksp…
intjftw Oct 6, 2022
f870f43
Modified C# parser to be able to work together with C++ parser.
intjftw Oct 10, 2022
f5f1877
Modified build system to build files in the build directory.
intjftw Nov 6, 2022
189025e
Separated several commands into different targets in build system.
intjftw Nov 7, 2022
64b4606
Updated .gitignore to exclude potential bin and obj folders within th…
intjftw Jan 6, 2023
ee9ab0d
Small fixes.
intjftw Jan 8, 2023
6e30294
Merge branch 'Ericsson:master' into csharp_plugin
intjftw Feb 13, 2023
12ac2a1
Small refactorings.
intjftw Mar 29, 2023
48f9983
Refactored the parsing command to include any number of source file d…
intjftw Mar 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ jobs:
llvm-10-dev clang-10 libclang-10-dev default-jdk libssl1.0-dev libgraphviz-dev
libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev

- name: Install dotnet SDK
if: ${{ matrix.os == 'ubuntu-18.04' }}
run: |
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https && sudo apt-get update && sudo apt-get install -y dotnet-sdk-6.0

- name: Remove default Postgresql Ubuntu 18
if: ${{ matrix.os == 'ubuntu-18.04' && matrix.db == 'postgresql' }}
run: sudo apt-get remove libpq5
Expand Down Expand Up @@ -84,7 +92,7 @@ jobs:
--enable-tutorial=no --enable-tests=no --with-libevent --with-zlib --without-nodejs
--without-lua --without-ruby --without-csharp --without-erlang --without-perl
--without-php --without-php_extension --without-dart --without-haskell --without-go
--without-rs --without-haxe --without-dotnetcore --without-d --without-qt4 --without-qt5
--without-rs --without-haxe --without-d --without-qt4 --without-qt5
--without-java --without-swift

make install -j $(nproc)
Expand Down Expand Up @@ -133,6 +141,14 @@ jobs:
libclang-10-dev odb libodb-dev thrift-compiler libthrift-dev default-jdk libssl-dev
libgraphviz-dev libmagic-dev libgit2-dev ctags doxygen libgtest-dev npm libldap2-dev

- name: Install dotnet SDK
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https && sudo apt-get update && sudo apt-get install -y dotnet-sdk-6.0

- name: Install Postgresql Ubuntu 20
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.db == 'postgresql' }}
run: sudo apt-get install libodb-pgsql-dev postgresql-server-dev-12
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ nbproject/
*.swp
build/
build_*/

# C#
plugins/**/bin
plugins/**/obj
*.out
*.bak
9 changes: 9 additions & 0 deletions docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ARG DEBIAN_FRONTEND=noninteractive
# CodeCompass development dependencies.
RUN set -x && apt-get update -qq \
&& apt-get -y install --no-install-recommends \
wget \
cmake make \
default-jdk \
ctags \
Expand All @@ -31,6 +32,14 @@ RUN set -x && apt-get update -qq \
ln -s /usr/bin/gcc-9 /usr/bin/gcc && \
ln -s /usr/bin/g++-9 /usr/bin/g++

# Install .NET 6.
RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update; \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-6.0

# Build GTest.
RUN cd /usr/src/googletest && \
mkdir build && \
Expand Down
7 changes: 7 additions & 0 deletions docker/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ RUN set -x && apt-get update -qq && \
rm -rf /var/lib/apt/lists/ && \
set +x

# Install .NET 6.
RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update; \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-6.0

# Copy CodeCompass installed directory. (Change permission of the CodeCompass package.)
COPY --from=builder /CodeCompass-install /codecompass
Expand Down
9 changes: 9 additions & 0 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ARG DEBIAN_FRONTEND=noninteractive

RUN set -x && apt-get update -qq \
&& apt-get install -qqy --no-install-recommends \
wget \
llvm-10 \
libboost-filesystem-dev libboost-log-dev libboost-program-options-dev \
libsqlite3-dev \
Expand All @@ -36,6 +37,14 @@ RUN set -x && apt-get update -qq \
&& rm -rf /var/lib/apt/lists/ \
&& set +x

# Install .NET 6.
RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update; \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-6.0

ARG CC_GID=960
ARG CC_UID=960

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Licensed to the Apache Software Foundation(ASF) under one
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should investigate whether this large pack of Thrift files is really needed as source in the plugin. It seems unncessary.

// or more contributor license agreements.See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

using System.IO;
using System.Threading.Tasks;

using BenchmarkDotNet.Attributes;

using Thrift.Protocol;
using Thrift.Transport.Client;

namespace Thrift.Benchmarks
{
[MemoryDiagnoser]
public class CompactProtocolBenchmarks
{
private MemoryStream? _Stream;
private TProtocol? _Protocol;

[Params(10000)]
public int NumberOfOperationsPerIteration { get; set; }

[GlobalSetup]
public void GlobalSetup()
{
_Stream = new MemoryStream();
var transport = new TStreamTransport(_Stream, _Stream, null);
_Protocol = new TCompactProtocol(transport);
}

[GlobalCleanup]
public void GlobalCleanup()
{
_Protocol?.Dispose();
}

[Benchmark]
public async Task WriteString()
{
if ((_Protocol is null) || (_Stream is null))
throw new System.Exception("unexpected internal state");

for (int i = 0; i < NumberOfOperationsPerIteration; i++)
{
await _Protocol.WriteStringAsync("Thrift String Benchmark");
_Stream.Seek(0, SeekOrigin.Begin);
}
}

[Benchmark]
public async Task ReadString()
{
if ((_Protocol is null) || (_Stream is null))
throw new System.Exception("unexpected internal state");

await _Protocol.WriteStringAsync("Thrift String Benchmark");

for (int i = 0; i < NumberOfOperationsPerIteration; i++)
{
_Stream.Seek(0, SeekOrigin.Begin);
await _Protocol.ReadStringAsync();
}
}
}
}
29 changes: 29 additions & 0 deletions lib/csharp/thrift_netstd/Benchmarks/Thrift.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Licensed to the Apache Software Foundation(ASF) under one
// or more contributor license agreements.See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

using BenchmarkDotNet.Running;

namespace Thrift.Benchmarks
{
internal static class Program
{
public static void Main(string[] args)
{
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
Licensed to the Apache Software Foundation(ASF) under one
or more contributor license agreements.See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TieredCompilation>false</TieredCompilation>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Thrift\Thrift.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" />
</ItemGroup>

</Project>
7 changes: 7 additions & 0 deletions lib/csharp/thrift_netstd/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

</Project>
Loading