This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public override void Initialize(AnalysisContext context) | |
| { | |
| context.RegisterSyntaxTreeAction(AnalyzeTree); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public override void Initialize(AnalysisContext context) | |
| { | |
| context.RegisterSyntaxTreeAction(AnalyzeTree); | |
| } | |
| private void AnalyzeTree(SyntaxTreeAnalysisContext obj) | |
| { | |
| var fileName = obj.Tree.FilePath.Split('\\').Last(); | |
| var syntaxNode = obj.Tree.GetRoot(); | |
| var descendantNodes = syntaxNode.DescendantNodes(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) | |
| { | |
| foreach (var diagnostic in context.Diagnostics.Where(d => FixableDiagnosticIds.Contains(d.Id))) | |
| { | |
| context.RegisterCodeFix(CodeAction.Create("Arrange using statements", | |
| token => GetTransformedDocumentAsync(context.Document, diagnostic, token)), diagnostic); | |
| } | |
| await Task.FromResult(Task.CompletedTask); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static async Task<Document> GetTransformedDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) | |
| { | |
| try | |
| { | |
| SyntaxNode root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); | |
| var usings = root.DescendantNodes().OfType<UsingDirectiveSyntax>().ToList(); | |
| var orderedUsings = usings.OrderBy(o => new string(o.Name.ToString().TakeWhile(c => c != '.').ToArray())) | |
| .ThenBy(o => o.Name.ToString().Length) | |
| .ToList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var path = require('path'); | |
| const puppeteer = require('puppeteer'); | |
| var azure = require('azure-storage'); | |
| var https = require('https'); | |
| function timeout(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| //the chart might take a few seconds to load after the page is ready |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:8-slim | |
| # install chrome rather than relying on Puppeteer | |
| RUN apt-get update && apt-get install -y wget --no-install-recommends \ | |
| && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | |
| && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | |
| && apt-get update \ | |
| && apt-get install -y google-chrome-unstable --no-install-recommends \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && apt-get purge --auto-remove -y curl \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "crybot.imageanalyzer", | |
| "version": "1.0.0", | |
| "private": true, | |
| "dependencies": { | |
| "puppeteer": "^1.8.0", | |
| "azure-storage": "^2.10.1" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static IAzure GetAzureContext() | |
| { | |
| IAzure azure = Azure.Authenticate("credentials.json").WithDefaultSubscription(); | |
| var currentSubscription = azure.GetCurrentSubscription(); | |
| return azure; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "clientId": "a guid", | |
| "clientSecret": "secret guid", | |
| "subscriptionId": "subscription guid", | |
| "tenantId": "tenant guid", | |
| "activeDirectoryEndpointUrl": "https://login.microsoftonline.com", | |
| "resourceManagerEndpointUrl": "https://management.azure.com/", | |
| "activeDirectoryGraphResourceId": "https://graph.windows.net/", | |
| "sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", | |
| "galleryEndpointUrl": "https://gallery.azure.com/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //ContainerStatus is an enum that I made, it has just the following values | |
| //Unknown, | |
| //Missing, | |
| //Running, | |
| //Initializing, | |
| //ExceededDuration | |
| public ContainerStatus GetStatus() | |
| { | |
| try |