Run Microsoft Application Inspector on Docker to Test Source Code
Tried Microsoft Application Inspector to test projects' source code.
https://github.com/microsoft/ApplicationInspector:
A source code analyzer built for surfacing features of interest and other characteristics to answer the question 'What's in the code?' quickly using static analysis with a json based rules engine. Ideal for scanning components before use or detecting feature level changes.
It is supported on Windows, Linux, or MacOS.
Me? Following - https://ilapitan.com/2020/03/18/microsoft-application-inspector/ to run it on Docker.
1.
Dockerfile
FROM mcr.microsoft.com/dotnet/core/sdk
FROM mcr.microsoft.com/dotnet/sdk
RUN dotnet tool install --global Microsoft.CST.ApplicationInspector.CLI
ENV PATH $PATH:/root/.dotnet/tools
CMD ["/bin/bash"]
RUN dotnet tool install --global Microsoft.CST.ApplicationInspector.CLI
ENV PATH $PATH:/root/.dotnet/tools
CMD ["/bin/bash"]
2.
$ docker build -t ms-app-inspector .
3.
$ docker run -v /var/docker/ms-app-inspector/app-test:/root/app-test -it ms-app-inspector
-v | --volume = HOST-DIR:CONTAINER-DIR
4.
$ cp -ax ~/project-A/* /var/docker/ms-app-inspector/app-test/project-A/
$ docker exec -it be4cd2f23739 appinspector analyze -s /root/app-test/project-A/ -k none -o /root/app-test/
Analyze command running
100% source files processed
The output.html file size is large and may render slowly. Consider running using alternate output format options as needed.
Unable to launch output.html automatically. Set the BROWSER environment variable to your desired browser and try again or launch your browser and navigate to the file to view the report file manually.
Analyze command completed
See output file at output.html
100% source files processed
The output.html file size is large and may render slowly. Consider running using alternate output format options as needed.
Unable to launch output.html automatically. Set the BROWSER environment variable to your desired browser and try again or launch your browser and navigate to the file to view the report file manually.
Analyze command completed
See output file at output.html
-s, --source-path: Required. Source file or directory to inspect
-k, --file-path-exclusions: (Default: sample,example,test,docs,lib,.vs,.git) Exclude source files (none | default: sample,example,test,docs,lib,.vs,.git)
-o, --output-file-path: Output file path
-k, --file-path-exclusions: (Default: sample,example,test,docs,lib,.vs,.git) Exclude source files (none | default: sample,example,test,docs,lib,.vs,.git)
-o, --output-file-path: Output file path
References
Application Inspector
https://github.com/microsoft/ApplicationInspector
https://github.com/microsoft/ApplicationInspector
Update
- .Net SDK Docker Image changed: 2021-Apr-24