Permalink
Browse files

Treat warnings as errors + related fixes

  • Loading branch information...
1 parent 9752639 commit f26f4bf47e52c6540687b2f01120f387cc7ed3b3 @jagregory committed Feb 1, 2010
Showing with 192 additions and 149 deletions.
  1. +1 −0 src/Examples.FirstProject/Examples.FirstProject.csproj
  2. +22 −4 src/FluentNHibernate.4.5.resharper
  3. +2 −0 src/FluentNHibernate.Testing/FluentNHibernate.Testing.csproj
  4. +3 −1 src/FluentNHibernate.Testing/PersistenceModelTests/SubclassPersistenceModelTests.cs
  5. +2 −0 src/FluentNHibernate.Testing/Testing/PersistenceSpecificationExtensionsSpecs.cs
  6. +2 −0 src/FluentNHibernate.Testing/Testing/PersistenceSpecificationTester.cs
  7. +2 −0 src/FluentNHibernate/Automapping/AutoPersistenceModel.cs
  8. +1 −1 src/FluentNHibernate/Conventions/Inspections/BagInspector.cs
  9. +1 −1 src/FluentNHibernate/Conventions/Inspections/IBagInspector.cs
  10. +0 −2 src/FluentNHibernate/Conventions/Inspections/IManyToManyCollectionInspector.cs
  11. +0 −1 src/FluentNHibernate/Conventions/Inspections/IManyToManyInspector.cs
  12. +0 −1 src/FluentNHibernate/Conventions/Inspections/IMapInspector.cs
  13. +0 −1 src/FluentNHibernate/Conventions/Inspections/IOneToManyInspector.cs
  14. +1 −1 src/FluentNHibernate/Conventions/Inspections/ISetInspector.cs
  15. +1 −1 src/FluentNHibernate/Conventions/Inspections/MapInspector.cs
  16. +1 −1 src/FluentNHibernate/Conventions/Inspections/SetInspector.cs
  17. +1 −1 src/FluentNHibernate/Conventions/Instances/ICacheInstance.cs
  18. +11 −11 src/FluentNHibernate/Conventions/Instances/IClassInstance.cs
  19. +13 −13 src/FluentNHibernate/Conventions/Instances/ICollectionInstance.cs
  20. +1 −1 src/FluentNHibernate/Conventions/Instances/IColumnInstance.cs
  21. +5 −5 src/FluentNHibernate/Conventions/Instances/IComponentInstance.cs
  22. +4 −4 src/FluentNHibernate/Conventions/Instances/IHibernateMappingInstance.cs
  23. +10 −10 src/FluentNHibernate/Conventions/Instances/IIdentityInstance.cs
  24. +1 −1 src/FluentNHibernate/Conventions/Instances/IIndexManyToManyInstance.cs
  25. +5 −5 src/FluentNHibernate/Conventions/Instances/IJoinInstance.cs
  26. +8 −8 src/FluentNHibernate/Conventions/Instances/IJoinedSubclassInstance.cs
  27. +1 −1 src/FluentNHibernate/Conventions/Instances/IKeyInstance.cs
  28. +5 −5 src/FluentNHibernate/Conventions/Instances/IManyToOneInstance.cs
  29. +2 −2 src/FluentNHibernate/Conventions/Instances/IMapInstance.cs
  30. +1 −1 src/FluentNHibernate/Conventions/Instances/IOneToManyInstance.cs
  31. +9 −9 src/FluentNHibernate/Conventions/Instances/IOneToOneInstance.cs
  32. +11 −11 src/FluentNHibernate/Conventions/Instances/IPropertyInstance.cs
  33. +2 −2 src/FluentNHibernate/Conventions/Instances/ISetInstance.cs
  34. +8 −8 src/FluentNHibernate/Conventions/Instances/ISubclassInstance.cs
  35. +10 −10 src/FluentNHibernate/Conventions/Instances/IVersionInstance.cs
  36. +1 −1 src/FluentNHibernate/Conventions/Instances/IndexManyToManyInstance.cs
  37. +1 −1 src/FluentNHibernate/Conventions/Instances/JoinedSubclassInstance.cs
  38. +1 −1 src/FluentNHibernate/Conventions/Instances/KeyInstance.cs
  39. +3 −3 src/FluentNHibernate/Conventions/Instances/ManyToManyCollectionInstance.cs
  40. +2 −2 src/FluentNHibernate/Conventions/Instances/ManyToOneInstance.cs
  41. +9 −10 src/FluentNHibernate/Conventions/Instances/OneToOneInstance.cs
  42. +1 −0 src/FluentNHibernate/FluentNHibernate.csproj
  43. +22 −3 src/FluentNHibernate/Mapping/FilterPart.cs
  44. +1 −1 src/FluentNHibernate/MappingModel/Collections/ArrayMapping.cs
  45. +1 −1 src/FluentNHibernate/MappingModel/Collections/BagMapping.cs
  46. +1 −1 src/FluentNHibernate/MappingModel/Collections/ListMapping.cs
  47. +1 −1 src/FluentNHibernate/MappingModel/Collections/MapMapping.cs
  48. +1 −1 src/FluentNHibernate/MappingModel/Collections/SetMapping.cs
@@ -38,6 +38,7 @@
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
@@ -127,6 +127,7 @@
<ANONYMOUS_METHOD_DECLARATION_BRACES>NEXT_LINE</ANONYMOUS_METHOD_DECLARATION_BRACES>
<BLANK_LINES_AROUND_FIELD>0</BLANK_LINES_AROUND_FIELD>
<EMPTY_BLOCK_STYLE>TOGETHER</EMPTY_BLOCK_STYLE>
+ <EXPLICIT_PRIVATE_MODIFIER>False</EXPLICIT_PRIVATE_MODIFIER>
<INDENT_ANONYMOUS_METHOD_BLOCK>False</INDENT_ANONYMOUS_METHOD_BLOCK>
<INDENT_EMBRACED_INITIALIZER_BLOCK>False</INDENT_EMBRACED_INITIALIZER_BLOCK>
<INDENT_SIZE>4</INDENT_SIZE>
@@ -158,7 +159,26 @@
<WRAP_LINES>False</WRAP_LINES>
</FormatSettings>
<UsingsSettings />
- <Naming2 />
+ <Naming2>
+ <ExceptionName IsNull="False">
+ </ExceptionName>
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
+ <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
+ <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
+ </Naming2>
</CSharp>
<VB>
<FormatSettings>
@@ -182,16 +202,14 @@
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
- <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
<UserRule Inspect="True" Prefix="" Suffix="" Style="aa_bb" StaticnessKind="Static, Instance" AccessRight="Private, Protected, ProtectedInternal, Internal, Public" Description="MSpec naming">
<ElementKinds>
- <Kind Name="CLASS" />
<Kind Name="Machine.Specifications_Behavior" />
<Kind Name="Machine.Specifications_Context" />
- <Kind Name="Machine.Specifications_ContextBase" />
<Kind Name="Machine.Specifications_Specification" />
<Kind Name="Machine.Specifications_SupportingField" />
<Kind Name="Machine.Specifications_Fields" />
@@ -22,6 +22,8 @@
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
+ <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
+ <NoWarn>169</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\Release\</OutputPath>
@@ -224,13 +224,15 @@ public abstract class RevolutionaryThought : IntelligentThought
public class Epiphany : RevolutionaryThought
{ }
- public class ThoughtMap : ClassMap<Thought>
+ public sealed class ThoughtMap : ClassMap<Thought>
{
public ThoughtMap()
{
Id(x => x.Id);
+#pragma warning disable 618,612
JoinedSubClass<Epiphany>("Id", x => { });
JoinedSubClass<RandomThought>("Id", x => { });
+#pragma warning restore 618,612
}
}
}
@@ -287,7 +287,9 @@ public override void establish_context()
public override void because()
{
+#pragma warning disable 618,612
sut.CheckEnumerable(x => x.ReferenceList, listSetter, new[] {new OtherEntity(), new OtherEntity()});
+#pragma warning restore 618,612
}
[Test]
@@ -149,7 +149,9 @@ public void should_not_be_equal_without_the_equality_comparer()
public void Can_test_enumerable()
{
var kittens = new[] {new Kitten {Id = 3, Name = "kitten3"}, new Kitten {Id = 4, Name = "kitten4"}};
+#pragma warning disable 618,612
_spec.CheckEnumerable(x => x.EnumerableOfKittens, (cat, kitten) => cat.AddKitten(kitten), kittens);
+#pragma warning restore 618,612
typeof(ApplicationException).ShouldBeThrownBy(() => _spec.VerifyTheMappings());
}
@@ -172,7 +172,9 @@ private bool ShouldMap(Type type)
return false; // generic definition is excluded
if (type.IsAbstract && Expressions.AbstractClassIsLayerSupertype(type))
return false; // is abstract and a layer supertype
+#pragma warning disable 618,612
if (Expressions.IsBaseType(type))
+#pragma warning restore 618,612
return false; // excluded
if (type == typeof(object))
return false; // object!
@@ -21,7 +21,7 @@ public new bool IsSet(Member property)
return mapping.IsSpecified(mappedProperties.Get(property));
}
- public string OrderBy
+ public new string OrderBy
{
get { return mapping.OrderBy; }
}
@@ -2,6 +2,6 @@
{
public interface IBagInspector : ICollectionInspector
{
- string OrderBy { get; }
+ new string OrderBy { get; }
}
}
@@ -5,8 +5,6 @@ namespace FluentNHibernate.Conventions.Inspections
public interface IManyToManyCollectionInspector : ICollectionInspector
{
new IManyToManyInspector Relationship { get; }
- Type ChildType { get; }
-
bool HasExplicitTable { get; }
IManyToManyCollectionInspector OtherSide { get; }
}
@@ -8,7 +8,6 @@ public interface IManyToManyInspector : IRelationshipInspector
{
IDefaultableEnumerable<IColumnInspector> Columns { get; }
Type ChildType { get; }
- TypeReference Class { get; }
Fetch Fetch { get; }
string ForeignKey { get; }
bool LazyLoad { get; }
@@ -3,7 +3,6 @@
public interface IMapInspector : ICollectionInspector
{
IIndexInspectorBase Index { get; }
- string OrderBy { get; }
string Sort { get; }
}
}
@@ -6,7 +6,6 @@ namespace FluentNHibernate.Conventions.Inspections
public interface IOneToManyInspector : IRelationshipInspector
{
Type ChildType { get; }
- TypeReference Class { get; }
NotFound NotFound { get; }
}
}
@@ -2,7 +2,7 @@
{
public interface ISetInspector : ICollectionInspector
{
- string OrderBy { get; }
+ new string OrderBy { get; }
string Sort { get; }
}
}
@@ -37,7 +37,7 @@ public IIndexInspectorBase Index
throw new InvalidOperationException("This IIndexMapping is not a valid type for inspecting");
}
}
- public string OrderBy
+ public new string OrderBy
{
get { return mapping.OrderBy; }
}
@@ -21,7 +21,7 @@ public new bool IsSet(Member property)
return mapping.IsSpecified(mappedProperties.Get(property));
}
- public string OrderBy
+ public new string OrderBy
{
get { return mapping.OrderBy; }
}
@@ -12,6 +12,6 @@ public interface ICacheInstance : ICacheInspector
void IncludeNonLazy();
void CustomInclude(string include);
void CustomUsage(string custom);
- void Region(string name);
+ new void Region(string name);
}
}
@@ -13,16 +13,16 @@ public interface IClassInstance : IClassInspector
new ICacheInstance Cache { get; }
new ISchemaActionInstance SchemaAction { get; }
void Table(string tableName);
- void DynamicInsert();
- void DynamicUpdate();
- void BatchSize(int size);
- void LazyLoad();
- void ReadOnly();
- void Schema(string schema);
- void Where(string where);
- void Subselect(string subselectSql);
- void Proxy<T>();
- void Proxy(Type type);
- void Proxy(string type);
+ new void DynamicInsert();
+ new void DynamicUpdate();
+ new void BatchSize(int size);
+ new void LazyLoad();
+ new void ReadOnly();
+ new void Schema(string schema);
+ new void Where(string where);
+ new void Subselect(string subselectSql);
+ new void Proxy<T>();
+ new void Proxy(Type type);
+ new void Proxy(string type);
}
}
@@ -11,10 +11,10 @@ public interface ICollectionInstance : ICollectionInspector
new IKeyInstance Key { get; }
new IRelationshipInstance Relationship { get; }
void Table(string tableName);
- void Name(string name);
- void Schema(string schema);
- void LazyLoad();
- void BatchSize(int batchSize);
+ new void Name(string name);
+ new void Schema(string schema);
+ new void LazyLoad();
+ new void BatchSize(int batchSize);
void ReadOnly();
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
@@ -24,15 +24,15 @@ public interface ICollectionInstance : ICollectionInspector
new ICollectionCascadeInstance Cascade { get; }
new IFetchInstance Fetch { get; }
new IOptimisticLockInstance OptimisticLock { get; }
- void Check(string constraint);
- void CollectionType<T>();
- void CollectionType(string type);
- void CollectionType(Type type);
- void Generic();
- void Inverse();
- void Persister<T>() where T : IEntityPersister;
- void Where(string whereClause);
- void OrderBy(string orderBy);
+ new void Check(string constraint);
+ new void CollectionType<T>();
+ new void CollectionType(string type);
+ new void CollectionType(Type type);
+ new void Generic();
+ new void Inverse();
+ new void Persister<T>() where T : IEntityPersister;
+ new void Where(string whereClause);
+ new void OrderBy(string orderBy);
void Subselect(string subselect);
}
}
@@ -4,6 +4,6 @@ namespace FluentNHibernate.Conventions.Instances
{
public interface IColumnInstance : IColumnInspector
{
- void Length(int length);
+ new void Length(int length);
}
}
@@ -6,17 +6,17 @@ namespace FluentNHibernate.Conventions.Instances
public interface IComponentBaseInstance : IComponentBaseInspector
{
new IAccessInstance Access { get; }
- void Update();
- void Insert();
- void Unique();
- void OptimisticLock();
+ new void Update();
+ new void Insert();
+ new void Unique();
+ new void OptimisticLock();
}
public interface IComponentInstance : IComponentBaseInstance, IComponentInspector
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
IComponentInstance Not { get; }
- void LazyLoad();
+ new void LazyLoad();
}
public interface IDynamicComponentInstance : IComponentBaseInstance, IDynamicComponentInspector
@@ -5,12 +5,12 @@ namespace FluentNHibernate.Conventions.Instances
{
public interface IHibernateMappingInstance : IHibernateMappingInspector
{
- void Catalog(string catalog);
- void Schema(string schema);
+ new void Catalog(string catalog);
+ new void Schema(string schema);
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
IHibernateMappingInstance Not { get; }
- void DefaultLazy();
- void AutoImport();
+ new void DefaultLazy();
+ new void AutoImport();
new ICascadeInstance DefaultCascade { get; }
new IAccessInstance DefaultAccess { get; }
}
@@ -7,23 +7,23 @@ namespace FluentNHibernate.Conventions.Instances
public interface IIdentityInstance : IIdentityInspector
{
void Column(string column);
- void UnsavedValue(string unsavedValue);
- void Length(int length);
+ new void UnsavedValue(string unsavedValue);
+ new void Length(int length);
void CustomType(string type);
void CustomType(Type type);
void CustomType<T>();
new IAccessInstance Access { get; }
IGeneratorInstance GeneratedBy { get; }
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
IIdentityInstance Not { get; }
- void Precision(int precision);
- void Scale(int scale);
- void Nullable();
- void Unique();
- void UniqueKey(string columns);
+ new void Precision(int precision);
+ new void Scale(int scale);
+ new void Nullable();
+ new void Unique();
+ new void UniqueKey(string columns);
void CustomSqlType(string sqlType);
- void Index(string index);
- void Check(string constraint);
- void Default(object value);
+ new void Index(string index);
+ new void Check(string constraint);
+ new void Default(object value);
}
}
@@ -4,6 +4,6 @@ namespace FluentNHibernate.Conventions.Instances
{
public interface IIndexManyToManyInstance : IIndexInstanceBase, IIndexManyToManyInspector
{
- void ForeignKey(string foreignKey);
+ new void ForeignKey(string foreignKey);
}
}
@@ -9,12 +9,12 @@ public interface IJoinInstance : IJoinInspector
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
IJoinInstance Not { get; }
new IFetchInstance Fetch { get; }
- void Inverse();
+ new void Inverse();
new IKeyInstance Key { get; }
- void Optional();
- void Schema(string schema);
+ new void Optional();
+ new void Schema(string schema);
void Table(string table);
- void Catalog(string catalog);
- void Subselect(string subselect);
+ new void Catalog(string catalog);
+ new void Subselect(string subselect);
}
}
Oops, something went wrong.

0 comments on commit f26f4bf

Please sign in to comment.