Skip to content

Commit aefb9f6

Browse files
committed
Enabling code static analysis for all projects
1 parent 5a044fa commit aefb9f6

35 files changed

+340
-89
lines changed

CustomDictionary.xml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!-- See http://msdn.microsoft.com/en-us/library/bb514188.aspx for details -->
2+
<Dictionary>
3+
<Words>
4+
<Unrecognized>
5+
</Unrecognized>
6+
<Recognized>
7+
<Word>e</Word> <!-- to get eTag variants working -->
8+
<Word>autofac</Word>
9+
<Word>api</Word>
10+
<Word>apis</Word>
11+
<Word>auth</Word>
12+
<Word>bson</Word>
13+
<Word>cors</Word>
14+
<Word>ctor</Word>
15+
<Word>deserializes</Word>
16+
<Word>dto</Word>
17+
<Word>edm</Word>
18+
<Word>guid</Word>
19+
<Word>hashset</Word>
20+
<Word>infos</Word>
21+
<Word>jwt</Word>
22+
<Word>loc</Word>
23+
<Word>mpns</Word>
24+
<Word>mvc</Word>
25+
<Word>nullables</Word>
26+
<Word>nuget</Word>
27+
<Word>queryables</Word>
28+
<Word>realtime</Word>
29+
<Word>rel</Word>
30+
<Word>rev</Word>
31+
<Word>rfc</Word>
32+
<Word>src</Word>
33+
<Word>CancellationToken</Word>
34+
<Word>CloudBlobStream</Word>
35+
<Word>CloudStorageAccount</Word>
36+
<Word>ServiceBus</Word>
37+
<Word>ServiceBusTrigger</Word>
38+
<Word>BrokeredMessage</Word>
39+
<Word>ICollector</Word>
40+
<Word>IAsyncCollector</Word>
41+
<Word>WebJobs</Word>
42+
<Word>TextWriter</Word>
43+
<Word>INameResolver</Word>
44+
<Word>IJobHostContextFactory</Word>
45+
<Word>ReflectedType</Word>
46+
<Word>IDictionary</Word>
47+
<Word>IQueryable</Word>
48+
<Word>ITableEntity</Word>
49+
<Word>CloudQueue</Word>
50+
<Word>IStorageQueueMessage</Word>
51+
<Word>IAttributeBindingSource</Word>
52+
<Word>ServiceProvider</Word>
53+
<Word>RequestedObjectKey</Word>
54+
<Word>FileAccess</Word>
55+
<Word>ReadWrite</Word>
56+
<Word>IStorageTable</Word>
57+
<Word>TableEntityContext</Word>
58+
<Word>TableName</Word>
59+
<Word>PropertyType</Word>
60+
<Word>TextReader</Word>
61+
<Word>Aborter</Word>
62+
<Word>Unparsable</Word>
63+
<Word>Unparsable</Word>
64+
<Word>Ninject</Word>
65+
<Word>PartitionKey</Word>
66+
<Word>RowKey</Word>
67+
<Word>BlobAttribute</Word>
68+
<Word>ConnectionString</Word>
69+
<Word>MessagingProvider</Word>
70+
<Word>CloudBlobContainer</Word>
71+
<Word>SingletonAttribute</Word>
72+
<Word>Prefetch</Word>
73+
<Word>ScopeId</Word>
74+
<Word>FunctionMetadata</Word>
75+
<Word>Debounce</Word>
76+
</Recognized>
77+
<Deprecated/>
78+
<Compound>
79+
<Term CompoundAlternate="CancellationToken">cancellationToken</Term>
80+
<Term CompoundAlternate="TableName">tableName</Term>
81+
<Term CompoundAlternate="ETag">etag</Term>
82+
<Term CompoundAlternate="ETag">eTag</Term>
83+
</Compound>
84+
<DiscreteExceptions>
85+
<Term>WebJobs</Term>
86+
<Term>ServiceBus</Term>
87+
<Term>PartitionKey</Term>
88+
<Term>RowKey</Term>
89+
<Term>BlobAttribute</Term>
90+
<Term>ConnectionString</Term>
91+
<Term>MessagingProvider</Term>
92+
<Term>SingletonAttribute</Term>
93+
<Term>ScopeId</Term>
94+
<Term>FunctionMetadata</Term>
95+
</DiscreteExceptions>
96+
</Words>
97+
<Acronyms>
98+
<CasingExceptions>
99+
<Acronym>ETag</Acronym>
100+
</CasingExceptions>
101+
</Acronyms>
102+
</Dictionary>

src/Common/CommonAssemblyInfo.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Reflection;
6+
using System.Runtime.InteropServices;
7+
8+
[assembly: AssemblyProduct("Microsoft Azure WebJobs SDK Script")]
9+
[assembly: AssemblyCompany("Microsoft Corporation")]
10+
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
11+
12+
[assembly: ComVisible(false)]
13+
[assembly: CLSCompliant(true)]

src/Common/PublicKey.snk

160 Bytes
Binary file not shown.
1.37 KB
Binary file not shown.

src/WebJobs.Script.Host/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,9 @@
88
[assembly: AssemblyTitle("WebJobs.Script.Host")]
99
[assembly: AssemblyDescription("")]
1010
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
12-
[assembly: AssemblyProduct("WebJobs.Script.Host")]
13-
[assembly: AssemblyCopyright("Copyright © 2015")]
1411
[assembly: AssemblyTrademark("")]
1512
[assembly: AssemblyCulture("")]
1613

17-
// Setting ComVisible to false makes the types in this assembly not visible
18-
// to COM components. If you need to access a type in this assembly from
19-
// COM, set the ComVisible attribute to true on that type.
20-
[assembly: ComVisible(false)]
21-
2214
// The following GUID is for the ID of the typelib if this project is exposed to COM
2315
[assembly: Guid("f5fab5a1-a816-441b-86bf-ca3cae2f7588")]
2416

src/WebJobs.Script.Host/WebJobs.Script.Host.csproj

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
15-
<TargetFrameworkProfile />
15+
<RunCodeAnalysis>true</RunCodeAnalysis>
16+
<CodeAnalysisRuleSet>..\src.ruleset</CodeAnalysisRuleSet>
17+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1618
</PropertyGroup>
1719
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1820
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -34,6 +36,7 @@
3436
<WarningLevel>4</WarningLevel>
3537
</PropertyGroup>
3638
<ItemGroup>
39+
<Compile Include="GlobalSuppressions.cs" />
3740
<Compile Include="Program.cs" />
3841
<Compile Include="Properties\AssemblyInfo.cs" />
3942
</ItemGroup>
@@ -151,7 +154,15 @@
151154
<Name>WebJobs.Script</Name>
152155
</ProjectReference>
153156
</ItemGroup>
154-
<ItemGroup />
157+
<ItemGroup>
158+
<CodeAnalysisDictionary Include="..\..\CustomDictionary.xml">
159+
<Link>CustomDictionary.xml</Link>
160+
<SubType>Designer</SubType>
161+
</CodeAnalysisDictionary>
162+
<Compile Include="..\Common\CommonAssemblyInfo.cs">
163+
<Link>Properties\CommonAssemblyInfo.cs</Link>
164+
</Compile>
165+
</ItemGroup>
155166
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
156167
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
157168
Other similar extension points exist, see Microsoft.Common.targets.

src/WebJobs.Script.WebHost/App_Start/AutofacBootstrap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace WebJobs.Script.WebHost.App_Start
1414
{
15-
public class AutofacBootstrap
15+
public static class AutofacBootstrap
1616
{
1717
internal static void Initialize(ContainerBuilder builder)
1818
{

src/WebJobs.Script.WebHost/App_Start/WebApiConfig.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Web.Http;
1+
using System;
2+
using System.Web.Http;
23
using Autofac;
34
using Autofac.Integration.WebApi;
45
using WebJobs.Script.WebHost.App_Start;
@@ -11,6 +12,11 @@ public static class WebApiConfig
1112
{
1213
public static void Register(HttpConfiguration config)
1314
{
15+
if (config == null)
16+
{
17+
throw new ArgumentNullException("config");
18+
}
19+
1420
var builder = new ContainerBuilder();
1521
builder.RegisterApiControllers(typeof(FunctionsController).Assembly);
1622
AutofacBootstrap.Initialize(builder);

src/WebJobs.Script.WebHost/Controllers/AdminController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public HttpResponseMessage Invoke(string name, [FromBody] FunctionInvocation inv
4343
return new HttpResponseMessage(HttpStatusCode.NotFound);
4444
}
4545

46-
string input = invocation.Input;
4746
ParameterDescriptor inputParameter = function.Parameters.First();
4847
Dictionary<string, object> arguments = new Dictionary<string, object>()
4948
{

src/WebJobs.Script.WebHost/Filters/AuthorizationLevelAttribute.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace WebJobs.Script.WebHost.Filters
1515
{
16-
public class AuthorizationLevelAttribute : AuthorizationFilterAttribute
16+
public sealed class AuthorizationLevelAttribute : AuthorizationFilterAttribute
1717
{
1818
public const string FunctionsKeyHeaderName = "x-functions-key";
1919

@@ -26,6 +26,11 @@ public AuthorizationLevelAttribute(AuthorizationLevel level)
2626

2727
public override void OnAuthorization(HttpActionContext actionContext)
2828
{
29+
if (actionContext == null)
30+
{
31+
throw new ArgumentNullException("actionContext");
32+
}
33+
2934
SecretManager secretManager = (SecretManager)actionContext.ControllerContext.Configuration.DependencyResolver.GetService(typeof(SecretManager));
3035

3136
if (!IsAuthorized(actionContext.Request, Level, secretManager))

0 commit comments

Comments
 (0)